[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.9.3 Functions
For all the following functions, if the number of characters which ought to be
written appears to exceed the maximum limit for an int
, nothing is
written in the stream (resp. to stdout
, to buf, to str),
the function returns -1, sets the erange flag, and (in
POSIX system only) errno
is set to EOVERFLOW
.
- Function: int mpfr_fprintf (FILE *stream, const char *template, …)
- Function: int mpfr_vfprintf (FILE *stream, const char *template, va_list ap)
Print to the stream stream the optional arguments under the control of the template string template. Return the number of characters written or a negative value if an error occurred.
- Function: int mpfr_printf (const char *template, …)
- Function: int mpfr_vprintf (const char *template, va_list ap)
Print to
stdout
the optional arguments under the control of the template string template. Return the number of characters written or a negative value if an error occurred.
- Function: int mpfr_sprintf (char *buf, const char *template, …)
- Function: int mpfr_vsprintf (char *buf, const char *template, va_list ap)
Form a null-terminated string corresponding to the optional arguments under the control of the template string template, and print it in buf. No overlap is permitted between buf and the other arguments. Return the number of characters written in the array buf not counting the terminating null character or a negative value if an error occurred.
- Function: int mpfr_snprintf (char *buf, size_t n, const char *template, …)
- Function: int mpfr_vsnprintf (char *buf, size_t n, const char *template, va_list ap)
Form a null-terminated string corresponding to the optional arguments under the control of the template string template, and print it in buf. If n is zero, nothing is written and buf may be a null pointer, otherwise, the n-1 first characters are written in buf and the n-th is a null character. Return the number of characters that would have been written had n be sufficiently large, not counting the terminating null character, or a negative value if an error occurred.
- Function: int mpfr_asprintf (char **str, const char *template, …)
- Function: int mpfr_vasprintf (char **str, const char *template, va_list ap)
Write their output as a null terminated string in a block of memory allocated using the current allocation function. A pointer to the block is stored in str. The block of memory must be freed using
mpfr_free_str
. The return value is the number of characters written in the string, excluding the null-terminator, or a negative value if an error occurred.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |