Binary to mpz_t
cic_3_b at yahoo.com
Sat Oct 25 09:28:12 CEST 2003
I believe what you are looking for is
mpz_import (check it out here)
I believe that does what you want.
--- James Buchanan <jamesb.au at ozemail.com.au> wrote:
> Hi everyone,
> I'd like to ask if anyone knows how I can slurp in binary data from
> a file
> and convert it into an mpz_t big int. For example, I'd like to
> open a file
> in binary mode:
> f = fopen("file.bin", "rb");
> and suck in 512 bytes, i.e. a typical disk sector:
> unsigned char stuff;
> fread(stuff, sizeof(char), 512, f);
> and then use whatever's in stuff to make the big int. I'd like
> it to
> interpret the 512-bit long bit pattern as an unsigned integer. I'd
> like to be able to write it back out as a 512-bit long bit pattern.
> How can I do this?
> Many Thanks,
> gmp-discuss mailing list
> gmp-discuss at swox.com
Live with it
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
More information about the gmp-discuss