Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
vfprintf, vprintf, vsprintf - formatted output of variable argument list
&pagelevel(4)&pagelevel
Syntax | #include <stdarg.h> #include <stdio.h> int vprintf(const char *format, va_list ap); int vfprintf(FILE *stream, const char *format, va_list ap); int vsprintf(char *s, const char *format, va_list ap); |
Description | vfprintf() , vprintf() and vsprintf() correspond to the functions fprintf() , printf() and sprintf() , respectively, except that instead of being called with a variable number of arguments, they are called with an argument list as defined by stdarg.h . The number of arguments in the argument list and their types are not known at the time of compilation.
Since the vprint functions invoke the va_arg macro, but not the va_end macro, the value of ap after the return is indeterminate. |
Return val. | See fprintf() . |
Errors | See fprintf() . |
Notes | The macro va_end( ap) should be called after using these functions in order to reset the pointer ap to a defined value so that any subsequent calls to these functions will have the correct initial values. vfprintf() always starts with the first argument in the variable argument list. It is possible to start output from any particular argument by issuing the appropriate number of va_arg calls before calling the vfprintf() function. Each va_arg call advances the position in the argument list by one argument.
The program environment determines whether vfprintf() is executed for a BS2000 or POSIX file. BS2000 The ANSI syntax of the format string applies both in KR mode (only available with C/C++ versions lower than V3) and in ANSI modes (as defined by the LANGUAGE-STANDARD operands of the SOURCE-PROPERTIES option). The following applies in the case of text files with SAM access mode and variable record length for which a maximum record length is also specified: When the specification split=no was entered for fopen() , records which are longer than the maximum record length are truncated to the maximum record length when they are written. By default or with the specification split=yes , these records are split into multiple records. If a record has precisely the maximum record length, a record of the length zero is written after it. (End) |
See also | fprintf() , stdarg.h , stdio.h , varargs.h .
|