代码语言:javascript复制
function FileIS64( Filename:string ):Boolean;
var
tsl:TStringStream;
rStr:AnsiString;
begin
Result := False;
if not FileExists(Filename) then Exit;
tsl := TStringStream.Create;
try
tsl.LoadFromFile(Filename);
tsl.Position := 0;
SetLength(rStr, tsl.Size * 2 );
BinToHex(@tsl.Bytes[0], PAnsiChar(rStr), tsl.Size);
Result := (Pos('5045000064', string(rStr)) > 1);
finally
FreeAndNil(tsl);
end;
end;
主是要转hex后, 判断数字.