Michael Van Canneyt wrote:
On Thu, 14 Dec 2006, Lee wrote:
Hi,
I have tried to get base64 encoding to work for me but still have trouble
doing this. I will need to be able to convert binary files to base 64 strings
and then convert them back to binary files. However, at this point I am only
trying to encode a file to base64 and then decode it to test out base64 unit.
I have tried different variations of the code below. The "decoded" file is
the same size as the original, but something goes wrong because I am using a
simple .wave file for testing and the "decoded" file does not play which
indicate a problem.
First, use the copyfrom method of TStream, it will be MUCH faster.
Second, you can use cmp to compare the files.
Please check at what byte offset they differ.
There used to be a bug in base64. Meanwhile it's fixed, but I'm not sure
this fix is in 2.0.4 of FPC. So it's important you give the version of FPC
as well.
Michael.
Thanks for replying Michael. I believe I am using FPC 2.0.4.
At any rate, I elected to use the EncodeBase64/DecodeBase64 methods of
synacode unit in Synapse distribution and it works well and I think are
a bit more intuitive. I'm using the Synapse library to send the encoded
file anyway so no big deal.
Thanks again for your reply.
--
Warm Regards,
Lee
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives