Registriert seit: 21. Okt 2003
1.194 Beiträge
Delphi 2006 Professional
|
zur base64 decodefile function aus der dp lib ?
21. Mär 2007, 11:52
ich bekomme einen zugriffsfehler ?
Base64DecodeFile(mystring,'c:\test.jpg');
Delphi-Quellcode:
function Base64DecodeFile(ABase64Str: String; AFileName: String): Boolean;
var
InSize, OutSize: Cardinal;
PIn, POut: Pointer;
begin
result:= False;
// get size of source
InSize := Length(ABase64Str);
// calculate size for destination
PIn := @ABase64Str[1];
OutSize := CalcDecodedSize(PIn, InSize);
// prepare string length to fit result data
with TMemoryStream.Create() do
try
SetSize(OutSize);
POut := Memory;
// decode !
if Base64Decode(PIn, InSize, POut) then
begin
SaveToFile(AFileName);
result:= True;
end;
finally
Free;
end;
end;
euer Peter Porka
|
|
Zitat
|