mirror of https://github.com/mkerrisk/man-pages
printf.3: Merge dprintf() and vdprintf() discussion into this page
Reported-by: Egmont Koblinger <egmont@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
c14e2adc7c
commit
62730046cc
|
@ -33,8 +33,8 @@
|
|||
.\"
|
||||
.TH PRINTF 3 2015-04-19 "GNU" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf,
|
||||
vsnprintf \- formatted output conversion
|
||||
printf, fprintf, dprintf, sprintf, snprintf, vprintf, vfprintf, vdprintf,
|
||||
vsprintf, vsnprintf \- formatted output conversion
|
||||
.SH SYNOPSIS
|
||||
.B #include <stdio.h>
|
||||
.sp
|
||||
|
@ -42,6 +42,8 @@ vsnprintf \- formatted output conversion
|
|||
.br
|
||||
.BI "int fprintf(FILE *" stream ", const char *" format ", ...);"
|
||||
.br
|
||||
.BI "int dprintf(int " fd ", const char *" format ", ...);"
|
||||
.br
|
||||
.BI "int sprintf(char *" str ", const char *" format ", ...);"
|
||||
.br
|
||||
.BI "int snprintf(char *" str ", size_t " size ", const char *" format ", ...);"
|
||||
|
@ -52,6 +54,8 @@ vsnprintf \- formatted output conversion
|
|||
.br
|
||||
.BI "int vfprintf(FILE *" stream ", const char *" format ", va_list " ap );
|
||||
.br
|
||||
.BI "int vdprintf(int " fd ", const char *" format ", va_list " ap );
|
||||
.br
|
||||
.BI "int vsprintf(char *" str ", const char *" format ", va_list " ap );
|
||||
.br
|
||||
.BI "int vsnprintf(char *" str ", size_t " size ", const char *" format \
|
||||
|
@ -72,7 +76,20 @@ _POSIX_C_SOURCE\ >=\ 200112L;
|
|||
or
|
||||
.I "cc -std=c99"
|
||||
.RE
|
||||
.sp
|
||||
.BR dprintf (),
|
||||
.BR vdprintf ():
|
||||
.PD 0
|
||||
.RS 4
|
||||
.TP 4
|
||||
Since glibc 2.10:
|
||||
_XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
|
||||
.TP
|
||||
Before glibc 2.10:
|
||||
_GNU_SOURCE
|
||||
.RE
|
||||
.ad
|
||||
.PD
|
||||
.SH DESCRIPTION
|
||||
The functions in the
|
||||
.BR printf ()
|
||||
|
@ -98,7 +115,17 @@ and
|
|||
.BR vsnprintf ()
|
||||
write to the character string
|
||||
.IR str .
|
||||
.PP
|
||||
|
||||
The function
|
||||
.BR dprintf ()
|
||||
is the same as
|
||||
.BR fprintf (3)
|
||||
except that it outputs to a file descriptor,
|
||||
.IR fd ,
|
||||
instead of to a
|
||||
.I stdio
|
||||
stream.
|
||||
|
||||
The functions
|
||||
.BR snprintf ()
|
||||
and
|
||||
|
@ -107,15 +134,17 @@ write at most
|
|||
.I size
|
||||
bytes (including the terminating null byte (\(aq\e0\(aq)) to
|
||||
.IR str .
|
||||
.PP
|
||||
|
||||
The functions
|
||||
.BR vprintf (),
|
||||
.BR vfprintf (),
|
||||
.BR vdprintf (),
|
||||
.BR vsprintf (),
|
||||
.BR vsnprintf ()
|
||||
are equivalent to the functions
|
||||
.BR printf (),
|
||||
.BR fprintf (),
|
||||
.BR dprintf (),
|
||||
.BR sprintf (),
|
||||
.BR snprintf (),
|
||||
respectively, except that they are called with a
|
||||
|
@ -131,8 +160,8 @@ macro, the value of
|
|||
is undefined after the call.
|
||||
See
|
||||
.BR stdarg (3).
|
||||
.PP
|
||||
These eight functions write the output under the control of a
|
||||
|
||||
All of these functions write the output under the control of a
|
||||
.I format
|
||||
string that specifies how subsequent arguments (or arguments accessed via
|
||||
the variable-length argument facilities of
|
||||
|
@ -855,11 +884,19 @@ The
|
|||
and
|
||||
.BR vsprintf ()
|
||||
functions conform to C89 and C99.
|
||||
|
||||
The
|
||||
.BR snprintf ()
|
||||
and
|
||||
.BR vsnprintf ()
|
||||
functions conform to C99.
|
||||
|
||||
The
|
||||
.BR dprintf ()
|
||||
and
|
||||
.BR vdprintf ()
|
||||
functions were originally GNU extensions that were later standardized
|
||||
in POSIX.1-2008.
|
||||
.PP
|
||||
Concerning the return value of
|
||||
.BR snprintf (),
|
||||
|
|
Loading…
Reference in New Issue