3
votes

I am making a builder/stub application. The builder is coded in XE2 while the stub is coded in Delphi 7.

In XE2 when I use "EncdDecd" it has functions to encode EncodeBase64 and DecodeBase64. But in Delphi 7 when I use EncdDecd it does not have the DecodeBase64 function that I need.

In my builder I am loading a file into a stream and encoding it to a B64 AnsiString and adding it to the resources of the stub. The goal is to have the stub decode this B64 AnsiString into a byte array and ultimately write it to a file on the disk.

2
Why base64? That's a very inefficient way to store binary data. I'd compress it with a zlib stream. You use base64 when you need to store/transmit as plain ascii text. - David Heffernan
To answer the question that you asked, you can simply use DecodeString and then treat the string return value as a byte array. But base64 still feels like the wrong solution. - David Heffernan

2 Answers

2
votes

All versions of Delphi from v6 onward ship with Indy preinstalled. Its IdCoderMIME unit has TIdEncoderMIME and TIdDecoderMIME classes for encoding/decoding base64 content.

0
votes

There is plenty of base64 free Delphi code that you can use. TurboPower LockBox 3 also has an implementation of base64. This is compilable in Delphi 7.