This section describes functions that perform input from an input/output
stream, and functions that output to an input/output stream.
Passing a null pointer for a stream
to any of these functions will make
them read from stdin
and write to stdout
, respectively.
When using any of these functions, you must include the <stdio.h>
standard header before mpfr.h, to allow mpfr.h to define
prototypes for these functions.
Output op on stream stream, as a string of digits in base base, rounded in the direction rnd. The base may vary from 2 to 36. Print n significant digits exactly, or if n is 0, enough digits so that op can be read back exactly (see
mpfr_get_str
).In addition to the significant digits, a decimal point (defined by the current locale) at the right of the first digit and a trailing exponent in base 10, in the form ‘eNNN’, are printed. If base is greater than 10, ‘@’ will be used instead of ‘e’ as exponent delimiter.
Return the number of bytes written, or if an error occurred, return 0.
Input a string in base base from stream stream, rounded in the direction rnd, and put the read float in rop.
This function reads a word (defined as a sequence of characters between whitespace) and parses it using
mpfr_set_str
(it may change). See the documentation ofmpfr_strtofr
for a detailed description of the valid string formats.Return the number of bytes read, or if an error occurred, return 0.