Importing integers

Marc Glisse marc.glisse at normalesup.org
Thu Feb 5 09:50:18 CET 2009


On Wed, 4 Feb 2009, Jernej Makovsek wrote:

> FILE *file;
> file = fopen("/home/file", "rb");
>
> //inic
> mpz_t t;
> mpz_init (t);
>
> size_t mpz_inp_raw(t,file);
>
> 	gmp_printf("file = %i\nt = %i\n", file, t);
[...]
> Output:
> file = 151445512
> t = -1074788044
>
> where "file" and "t" values change everytime the program is run. Why`s
> that?

Hello,

what exactly do you expect gmp_printf to do? The documentation is 
available here:
http://gmplib.org/manual/Formatted-Output-Strings.html
You may also want to have a look at the documentation of the basic printf 
function.

Here you are telling your program to print 2 pointers converted to 
integers, so getting two random 32 bit numbers is not unreasonnable.

-- 
Marc Glisse


More information about the gmp-discuss mailing list