type
myrec = record
id:dWord;
name:array[0..31] of WideChar;
three:dword;
count:dword;
ShuXing:Single;
ShuXing2:dword;
ShuXing3:dWORD;
end;
var
Form1: TForm1;
mystr:TMemoryStream;
nowmyrec:myrec;
implementation
USES Rtti;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
rttiContext: TRttiContext;
rttiType: TRttiType;
fields: TArray<TRttiField>;
item: myrec;
i:word;
begin
mystr:=TMemoryStream.Create;
mystr.LoadFromFile(ExtractFilePath(Application.exename)+'1.data');
mystr.Position:=20;
mystr.readbuffer(nowmyRec,88);
rttiType := rttiContext.GetType(TypeInfo(myRec));
fields := rttiType.GetFields;
for i := low(fields) to high(fields) do
begin
Memo1.Lines.Add(fields[i].GetValue(@nowmyRec).ToString );
end;
end;
end.
the myrec.name is Chinese characters,the length of myrec.name is 64 byte , i can not read the myrec.name to memo, please help me!!!