W
walter.preuninger
I am writing a program, using the gmp library. I need to take the
output (mpz_out_str) and put it back into a string. Is there an easy
way to take stream output, and 'place it' into a string?
I can do it with fopen, mpz_out_str, rewind, fgets.
Is there a better way such as using pipe or fdopen, dup etc?
Basically, I want (headers, variable declarations, error checking
excluded)
output=fopen("data.out",'w+");
mpz_out_str(output,10,mpz_data); /* Outputs mpz_data in base 10) */
rewind(output);
fgets(output,buffer,40);
Buffer would contain the human readable value contained in mpz_data.
Thanks,
Walter
output (mpz_out_str) and put it back into a string. Is there an easy
way to take stream output, and 'place it' into a string?
I can do it with fopen, mpz_out_str, rewind, fgets.
Is there a better way such as using pipe or fdopen, dup etc?
Basically, I want (headers, variable declarations, error checking
excluded)
output=fopen("data.out",'w+");
mpz_out_str(output,10,mpz_data); /* Outputs mpz_data in base 10) */
rewind(output);
fgets(output,buffer,40);
Buffer would contain the human readable value contained in mpz_data.
Thanks,
Walter