ViaThinkSoft CodeLib
This article is in:
CodeLib → Programming aids → Delphi
function IsBinaryFile(f: string): boolean;
var
Stream: TStream;
b: Byte;
begin
result := false;
Stream := TFileStream.Create(f, fmOpenRead);
try
while Stream.Read(b, SizeOf(b)) > 0 do
begin
if (b <= 31) and (b <> 9) and (b <> 10) and (b <> 13) then
begin
result := true;
Exit;
end;
end;
finally
Stream.Free;
end;
end;
Daniel Marschall
ViaThinkSoft Co-Founder
ViaThinkSoft Co-Founder