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;