Hi, Maybe you should pad this string to 4 before encoding it ?
Cheers, Pieter On Tue, 25 Aug 2009, Robert martin wrote: > Hi > > I have a set of functions (not written by me) that encode and decode > mime64 data. I want to take a file and mime64 encrypt it than at a > later point decrypt it. However I am having trouble calling the > functions and there is no help. > > Functions > > function Base64Encode(const InText: string): string; overload; > > function Base64Decode(const InText: string): string; overload; > > > To do the encode I have the following function > > var > fs : TFileStream; > BufferIn : AnsiString; > begin > fs := TFileStream.Create(FileName, fmOpenRead); > try > fs.Position := 0; > > SetString(BufferIn, nil, fs.Size); > fs.Read(Pointer(BufferIn)^, fs.Size); > Result := Base64Encode(BufferIn); > finally > fs.Free; > end; > > > I use a string list to save the output. I thought this was working but > when I come to decode it the system checks and finds it is an invalid > file (does not divide evenly by 4). Can anyone see what might be wrong > with the above? > > Cheers > Rob > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: > unsubscribe > _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe