COHERENT manpages
This page displays the COHERENT manpage for vfprintf() [Print formatted text into stream].
List of available manpages
Index
vfprintf() -- STDIO Function (libc) Print formatted text into stream #include <stdarg.h> #include <stdio.h> int vfprintf(fp, format, arguments) FILE*fp; char *format; va_list arguments; vfprintf() constructs a formatted string and writes it into the stream pointed to by fp. It translates integers, floating-point numbers, and strings into a variety of text formats. vfprintf() can handle a variable list of arguments of various types. It is roughly equivalent to fprintf()'s conversion specifier %r. format points to a string that can contain text, character constants, and one or more conversion specifications. A conversion specification describes how to convert a particular data type into text. Each conversion specification is introduced with the percent sign `%'. (To print a literal percent sign, use the escape sequence `%%'.) See printf() for further discussion of the conversion specification, and for a table of the type specifiers that can be used with vfprintf(). After format comes arguments. This is of type va_list, which is defined in the header file stdarg.h. It has been initialized by the macro va_start() and points to the base of the list of arguments used by vfprintf(). For more information, see the Lexicon entry for va_arg(). arguments should access one argument for each conversion specification in format, of the type appropriate to its conversion specification. For example, if format contains conversion specifications for an int, a long, and a string, then arguments access three arguments, being, respectively, an int, a long, and a char *. arguments can take only the data types acceptable to the macro va_arg(), namely, the basic types that can be converted to pointers simply by adding a `*' after the type name. See va_arg() for more information on this point. If there are fewer arguments than conversion specifications, then vfprintf()'s behavior is undefined (and probably unwelcome). If there are more, vfprintf() evaluates and then ignores every argument without a corresponding conversion specification. If an argument is not of the same type as its corresponding conversion specifier, then the behavior of vfprintf() is undefined. Thus, presenting an int where vfprintf() expects a char * may generate unwelcome results. If it wrote the formatted string correctly, vfprintf() returns the number of characters written. Otherwise, it returns a negative number. See Also fprintf(), libc, printf(), sprintf(), vprintf(), vsprintf() ANSI Standard, §7.9.6.7 Notes vfprintf() can construct a string up to at least 509 characters long.