reading binary file content into an mpz_t variable

foxmuldrster at foxmuldrster at
Mon Jan 17 09:48:13 CET 2011


This is a most unhelpful response. Obviously we cannot debug his code  
without seeing it, and since he didn't post it it's equally obvious he's not  
wanting his algorithm debugged, but is asking rather for an existing similar  
implementation in code that he can reference or examine, or to have the  
process explained in ways he can then apply to code, such as pseudo code or  
step-by-step methods.

I do not understand why some of the exceedingly unhelpful posts are even  
posted in this list. A little code, a little reference to the general  
process involved is so much more helpful than a response like "can't help  
without seeing your code" or "that's documented on page 5,783 in the manual,  
did you read it [jerk!]?" as Torbjorn routinely posts.

Aaaargh! I've never met so mant arrogant, unhelpful, elitist people as I  
have on some of the GNU project lists. Why is that? So many of the people  
who offer up source code to GNU are the most follow-on unhelpful,  
inconsiderate developers around. And why? There's nothing to be gained with  
an unhelpful response like this. It only builds up walls between ALL users  
and the project itself (and those developing it), places animosity between  
newbies looking to USE (not become totally fluent in, but use for their app)  
this amazing tool for their project, which is the very purpose of employing  
free software.

Is it too much to ask, given the nature of MOST people's USER needs, that  
you all consider that:

1) Not everybody wants or needs to spend so much time reading through an  
entire manual or section, when a proper response to a question would address  
their needs, such as might be found more traditionally in a google search on  
the more widely used projects, but since GMP is so narrowly used people  
often HAVE to come here,

2) These are people, human beings with feelings and personal  
wants/wishes/needs, who have likely tried to use what they know and what  
should be obvious or intuitive, only to have it break down with GMP,

3) The smallest quantity of non-manual directed help, with even pseudo-code  
goes so far to help and creates a better image for the project, and be  
generally helpful for the user.

Day after day I read these arrogant, cold, in-human responses to people's  
questions that are what you would occasionally get on other projects, but  
not more often than generally helpful ones (except on other GNU projects).  
It's so demeaning.

Maybe you need to hire a go-between or create a wiki to common questions,  
something Google crawls so users can try there first.

- Rick C. Hodgin

-----Original message-----
From: Sam Rawlins <sam.rawlins at>
To: gmp mailing list <gmp-discuss at>
Sent: Mon, Jan 17, 2011 02:37:45 GMT+00:00
Subject: Re: reading binary file content into an mpz_t variable

On Sun, Jan 16, 2011 at 4:02 PM, Erick Paquin <info at> wrote:

> 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.

Without seeing your code, this is impossible to debug.

> 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.

Here too; need to see your code.

> Any tips?
> Thanks,
> Erick P.
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at

Sam Rawlins
gmp-discuss mailing list
gmp-discuss at

More information about the gmp-discuss mailing list