Writes output to the stream under control of the wide-character format string. Format #include <wchar.h> int vfwprintf (FILE *stream, const wchar_t *format, va_list ap);
1 – Arguments
stream A file pointer. format A pointer to a wide-character string containing the format specifications. ap A variable list of the items needed for output.
2 – Description
The vfwprintf function is equivalent to the fwprintf function, with the variable argument list replaced by the ap argument. Initialize ap with the va_start macro (and possibly with subsequent va_arg calls) from <stdarg.h>. If the stream pointed to by stream has no orientation, vfwprintf makes the stream wide-oriented. See also fwprintf.
3 – Return Values
n The number of wide characters written. Negative value Indicates an error. The function sets errno to one of the following: o EILSEQ - Invalid character detected. o EINVAL - Insufficient arguments. o ENOMEM - Not enough memory available for conversion. o ERANGE - Floating-point calculations overflow. o EVMSERR - Nontranslatable OpenVMS error. vaxc$errno contains the OpenVMS error code. This might indicate that conversion to a numeric value failed because of overflow. The function can also set errno to the following as a result of errors returned from the I/O subsystem: o EBADF - The file descriptor is not valid. o EIO - I/O error. o ENOSPC - No free space on the device containing the file. o ENXIO - Device does not exist. o EPIPE - Broken pipe. o ESPIPE - Illegal seek in a file opened for append. o EVMSERR - Nontranslatable OpenVMS error. vaxc$errno contains the OpenVMS error code. This indicates that an I/O error occurred for which there is no equivalent C error code.
4 – Examples
The following example shows the use of the vfwprintf function in a general error reporting routine: #include <stdarg.h> #include <stdio.h> #include <wchar.h> void error(char *function_name, wchar_t *format, . . . ); { va_list args; va_start(args, format); /* print out name of function causing error */ fwprintf(stderr, L"ERROR in %s: ", function_name); /* print out remainder of message */ vfwprintf(stderr, format, args); va_end(args); }