David edwards jr wrote:
I need to make a string from a variable x
mpz_t x;
     char buffer[100];

     mpz_set_str(x, "7612058254738945", 10);

I need to print x into the buffer.

See for example [1] ;-)

(MPIR doesn't seem to have browseable online documentation; you might download its documentation as a single PDF file [2] though.)

The function you're probably looking for is gmp_snprintf().

Works like C's snprintf(), but in addition supports GMP-specific format specifiers, e.g. "%Zd" for an mpz_t (in decimal notation); cf. [3].


-leif

[1] https://gmplib.org/manual/Formatted-Output-Functions.html#Formatted-Output-Functions

[2] http://mpir.org/mpir-2.6.0.pdf

[3] https://gmplib.org/manual/Formatted-Output-Strings.html#Formatted-Output-Strings

--
() The ASCII Ribbon Campaign
/\   Help Cure HTML E-Mail

--
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mpir-devel+unsubscr...@googlegroups.com.
To post to this group, send email to mpir-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/mpir-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to