TBinaryReader
TBinaryReader
uses
SysUtils,
Classes;
// Using BinaryReader
procedure ReadBinary(filename: string);
var
AFile: TFileStream;
BR: TBinaryReader;
AInteger: Integer;
ADouble: Double;
AChar: Char;
AString: String;
begin
AFile := TFileStream.Create(filename, fmOpenRead);
BR := TBinaryReader.Create(AFile, TEncoding.Unicode, false);
try
// read an integer and write it to the console
AInteger := BR.ReadInteger;
Writeln(AInteger);
// read a double and write it to the console
ADouble := BR.ReadDouble;
Writeln(ADouble);
// read a char and write it to the console
AChar := BR.ReadChar;
Writeln(AChar);
// read a string and write it to the console
AString := BR.ReadString;
Writeln(AString);
BR.Close;
finally
BR.Free;
AFile.Free;
end;
end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/13636050.html

浙公网安备 33010602011771号