PRINTF(3) BSD Library Functions Manual PRINTF(3)
NAME
asprintf, fprintf, printf, snprintf, sprintf, vasprintf, vfprintf, vprintf, vsnprintf, vsprintf -- formatted output conversion
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdio.h>
int
asprintf(char **ret, const char *format, ...);
int
fprintf(FILE *restrict stream, const char *restrict format, ...);
int
printf(const char *restrict format, ...);
int
snprintf(char *restrict s, size_t n, const char *restrict format, ...);
int
sprintf(char *restrict s, const char *restrict format, ...);
#include <stdarg.h>
#include <stdio.h>
int
vasprintf(char **ret, const char *format, va_list ap);
int
vfprintf(FILE *restrict stream, const char *restrict format, va_list ap);
int
vprintf(const char *restrict format, va_list ap);
int
vsnprintf(char *restrict s, size_t n, const char *restrict format, va_list ap);
int
vsprintf(char *restrict s, 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 out-
put to stdout, the standard output stream; fprintf() and vfprintf() write output to the given output stream; 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 '