Delphi—将字符串赋给记录类型
如:
Type
TStudent = packed record
sex : char;
age : array[1..2] of char;
name : array[1..8] of char;
end;。。。。。。。。。。。。。
var
my : TStudent;
s : string;
begin
s := '120whshengi';
ZeroMemory(@my,sizeof(TStudent));
StrLCopy(@my,pchar(s),sizeof(TStudent));
showmessage(my.sex + #13+#10 + my.age + #13+#10 + my.name );end;