A
agang
Unregistered / Unconfirmed
GUEST, unregistred user!
MyStream:= TFileStream.Create('xxx.xxx', fmCreate);
try
PChar:= PChar(AString);
Size:= Length(PChar);
MyStream.Write(Size, SizeOf(Integer));
MyStream.Write(PChar, Size);
PChar:= PChar(BString);
Size:= Length(PChar);
MyStream.Write(Size, SizeOf(Integer));
MyStream.Write(PChar, Size);
finnaly
MyStream.Free;
end;
...........
...........
...........
用相反的方法读取AString, BString
MyStream:= TFileStream.Create('xxx.xxx', fmOpenRead);
try
MyStream.Read(Size, SizeOf(Integer));
MyStream.Read(PChar, Size);
AString:= PChar;
MyStream.Read(Size, SizeOf(Integer));
MyStream.Read(PChar, Size);
BSTring:=PChar;
finnaly
MyStream.Free;
end;
为什么?上天如此爱捉弄人,此方法时好时坏
但读出乱码的时候更多
那位高手愿意出手救救苦命的人呐
try
PChar:= PChar(AString);
Size:= Length(PChar);
MyStream.Write(Size, SizeOf(Integer));
MyStream.Write(PChar, Size);
PChar:= PChar(BString);
Size:= Length(PChar);
MyStream.Write(Size, SizeOf(Integer));
MyStream.Write(PChar, Size);
finnaly
MyStream.Free;
end;
...........
...........
...........
用相反的方法读取AString, BString
MyStream:= TFileStream.Create('xxx.xxx', fmOpenRead);
try
MyStream.Read(Size, SizeOf(Integer));
MyStream.Read(PChar, Size);
AString:= PChar;
MyStream.Read(Size, SizeOf(Integer));
MyStream.Read(PChar, Size);
BSTring:=PChar;
finnaly
MyStream.Free;
end;
为什么?上天如此爱捉弄人,此方法时好时坏
但读出乱码的时候更多
那位高手愿意出手救救苦命的人呐