vfwprintf

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 arg);

Arguments

stream
A file pointer.
format
A pointer to a wide-character string containing the format specifications. For more information about format and conversion specifications and their corresponding arguments, see Chapter 2.
arg
A variable list of the items needed for output.

Description

This function is equivalent to the fwprintf function, with the variable argument list replaced by the arg argument. Initialize arg 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 in this section

Return Values
The number of wide characters written. 
Negative value  Indicates an error. The function sets errno to one of the following:

  • EILSEQ - Invalid character detected.

  • EINVAL - Insufficient arguments.

  • ENOMEM - Not enough memory available for conversion.

  • ERANGE - Floating-point calculations overflow.

  • EVMSERR - Nontranslatable VMS error. vaxc$errno contains the VMS 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:

  • EBADF - The file descriptor is not valid.

  • EIO - I/O error.

  • ENOSPC - No free space on the device containing the file.

  • ENXIO - Device does not exist.

  • EPIPE - Broken pipe.

  • ESPIPE - Illegal seek in a file opened for append.

  • EVMSERR - Nontranslatable VMS error. vaxc$errno contains the VMS error code. This indicates that an I/O error occurred for which there is no equivalent C error code.
 

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);
     }
    


Previous Page | Next Page | Table of Contents | Index