reading binary file content into an mpz_t variable
sam.rawlins at gmail.com
Mon Jan 17 17:48:00 CET 2011
On Mon, Jan 17, 2011 at 7:09 AM, Erick Paquin <info at erickpaquin.com> wrote:
> Thanks for all the answers. I'll do some more testing tonight and will send
> in some code if I'm still unsuccessful.
Sorry if I came off as brief. I think that Rick and Gabriel gave you some
good information to work with. And, in case you are discouraged, people
often can help out a lot if you post a snippet of code. I think people get a
little excited/intrigued when presented with code-with-a-bug.
Please do post back if you get stuck again.
> On Sun, Jan 16, 2011 at 6:02 PM, Erick Paquin <info at erickpaquin.com>
> > Hi Everyone,
> > Please bear with me as my programming skills are still relatively new.
> > I've tried a few things but I cannot seem to do what I want.
> > I would basically like to read the "entire" content of a file (its
> > hex/binary content) into an mpz_t variable for later processing.
> > I've tried with both the mpz_inp_str and the mpz_inp_raw functions and
> > I try to see the number of bytes read from these functions it always
> > returns 0 (as if an error occurred) or it crashes the application with a
> > memory segmentation fault.
> > Actually I am not also 100% sure of how to "read" the size_t returned
> > from the gmp functions (do you assign the function to an int variable and
> > read it?). Any help on that too would be awesome.
> > How would you go about in the simplest way possible read the entire
> > of a file into an mpz_t variable?
> > I've also tried with fread which actually works but then to transfer the
> > content of my fread into an mpz_t variable I couldn't find how.
> > Any tips?
> > Thanks,
> > Erick P.
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
More information about the gmp-discuss