[fpc-pascal] How to convert a large integer to base64

Frank Church vfclists at gmail.com
Mon Jan 17 17:28:21 CET 2011


On 15 January 2011 18:52, Henry Vermaak <henry.vermaak at gmail.com> wrote:

> On 15 January 2011 17:52, Frank Church <vfclists at gmail.com> wrote:
> >
> > Is there a FCL library that can be used to convert a large integer into
> > base64 format?
>
> Do you know about the base64 unit?
>
>

I have it working now, but I have noticed that if the length of string is
not a multiple of 3, it crashes.

Is there a way of adapting a string with a length that is not a multiple of
3 to allow it to encode, but yet
decode it back to the original string?

The other part is I want to pass the int64 in binary form.

Will a pointer to the integer and setting the length to copy to 8 be the
right approach?

i.e

Encoder.CopyFrom(P^.Integer64Value, 8)

Of course the 8 will generate an error.




Henry
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



-- 
Frank Church

=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110117/f2207c80/attachment.html>


More information about the fpc-pascal mailing list