TBinaryWriter
TBinaryWriter
procedure WriteBinary(filename: string); var AFile: TFileStream; BW: TBinaryWriter; AInteger: Integer; ADouble: Double; AChar: Char; AString: String; begin AFile := TFileStream.Create(filename, fmOpenWrite or fmCreate); BW := TBinaryWriter.Create(AFile, TEncoding.Unicode, false); try AInteger := 10; // write an integer to stream BW.Write(AInteger); ADouble := 0.34; // write a double to stream BW.Write(ADouble); AChar := 'A'; // write a char to stream BW.Write(AChar); // write a string to stream AString := 'Hello world!'; BW.Write(AString); BW.Close; finally BW.Free; AFile.Free; end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/13636057.html