to Jason Law
用你的代码试了下,有个问题请教!
procedure TForm1.Button1Click(Sender: TObject);
var
MyFile :TMyFile;
f: file of Byte;
i: integer;
s: string;
begin
AssignFile(f,ExtractFilePath(ParamStr(0))+'11.joe');
MyFile.Key1 :='1';
for i := 0 to memo1.Lines.Count-1 do
s:=s+memo1.Lines.Strings+#13#10;
myfile.key2:=s;
showmessage(s);//这里能看到字符串.
{
MyFile.Key2 :='ppp'+#13#10+
'aaa13是'+#13#10+
'sss13'+#13#10+
'中国人'+#13#10+
'英语3'+#13#10+
'梦想3'+#13#10+
'丽丽 '+#13#10+
'燕燕燕燕+'+#13#10+
'敏敏敏敏敏 ';
}
Rewrite(f);
BlockWrite(f,MyFile,SizeOf(MyFile));
CloseFile(f);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
MyFile :TMyFile;
f: file of Byte;
begin
AssignFile(f,ExtractFilePath(ParamStr(0))+'11.joe');
Reset(f);
BlockRead(f,MyFile,SizeOf(MyFile));
ShowMessage(MyFile.Key1 );
ShowMessage(MyFile.Key2 );//MyFile.Key2为空为什么?
CloseFile(f);
end;