PRINTF(3) BSD Library Functions Manual PRINTF(3)
NAME
printf, fprintf, sprintf, snprintf, asprintf, dprintf, vprintf, vfprintf, vsprintf, vsnprintf, vasprintf, vdprintf -- formatted output con-
version
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdio.h>
int
printf(const char * restrict format, ...);
int
fprintf(FILE * restrict stream, const char * restrict format, ...);
int
sprintf(char * restrict str, const char * restrict format, ...);
int
snprintf(char * restrict str, size_t size, const char * restrict format, ...);
int
asprintf(char **ret, const char *format, ...);
int
dprintf(int fd, const char * restrict format, ...);
#include <stdarg.h>
int
vprintf(const char * restrict format, va_list ap);
int
vfprintf(FILE * restrict stream, const char * restrict format, va_list ap);
int
vsprintf(char * restrict str, const char * restrict format, va_list ap);
int
vsnprintf(char * restrict str, size_t size, const char * restrict format, va_list ap);
int
vasprintf(char **ret, const char *format, va_list ap);
int
vdprintf(int fd, const char * restrict format, va_list ap);
DESCRIPTION
The printf() family of functions produces output according to a format as described below. The printf() and vprintf() functions write output
to stdout, the standard output stream; fprintf() and vfprintf() write output to the given output stream; dprintf() and vdprintf() write out-
put to the given file descriptor; sprintf(), snprintf(), vsprintf(), and vsnprintf() write to the character string s; and asprintf() and
vasprintf() dynamically allocate a new string with malloc(3).
Extended locale versions of these functions are documented in printf_l(3). See xlocale(3) for more information.
These functions write the output under the control of a format string that specifies how subsequent arguments (or arguments accessed via the
variable-length argument facilities of stdarg(3)) are converted for output.
These functions return the number of characters printed (not including the trailing '