Converting the number to bases above 62

Arsène Lupin detentor at
Sun Sep 23 15:45:39 CEST 2007


I'd like to convert an mpz_class or mpz_t number to a base 256, for it
to fill a byte vector.
But all the convertion functions only work until base 62. Any of you know
another way of converting the base? My real problem is that I wanted to save
the number in a file, but I realized that the GMP, even for integer (which
is my application uses - only natural numbers, not signed), somewhat writes
to the file (using mpz_out_raw) more than the bytes needs to be stored. Even
though the difference is about bytes, its critical to my project that it
writes to the file only the necessary bytes. Any ideas that could help me?

Thanks in advance.

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the gmp-discuss mailing list