[DUG] Uncode migration question

Robert Martin rob at chreos.co.nz
Thu Oct 18 10:16:03 NZDT 2012


Hi

Just trying to get a basic app running in XE2 (not really a full blown 
migration yet)

I have the following function in a unit that is years old (not written 
by me)

procedure Base64Encode(const InText: PAnsiChar; var OutText: PAnsiChar);
var
   InSize, OutSize: Cardinal;
begin

   // get size of source
   InSize := Length(InText);

   // calculate size for destination
   OutSize := CalcEncodedSize(InSize);

   // reserve memory
   OutText := StrAlloc(Succ(OutSize));

   OutText[OutSize] := #0;

   // encode !
   Base64Encode(InText, InSize, OutText);
end;


StrAlloc apparently now allocates a pWideChar.  What Call should I use 
to allocate a PAnsiChar?


Cheers
Rob



More information about the Delphi mailing list