Da du ja nur den Speicher Kopierst müste die Rückwärtsfunction so aussehen, oder ?
Delphi-Quellcode:
type
TDataRec = record
aString: string[128];
aFloat: float;
aByte: Byte;
end;
function MakeString(drec: TDataRec): string;
begin
Setlength(Result, sizeof(drec));
CopyMem(@drec,@Result[1],sizeof(drec));
end;
function ReverseMakeString(drec: String): TDataRec;
begin
// Setlength(Result, sizeof(drec));
CopyMem(@drec[1],@Result,sizeof(Result));
end;