VMS Help  —  CRTL  fwprintf
    Writes output to the stream under control of the wide-character
    format string.

    Format

      #include  <wchar.h>

      int fwprintf  (FILE *stream, const wchar_t *format, . . . );

1  –  Arguments

 stream

    A file pointer.

 format

    A pointer to a wide-character string containing the format
    specifications.

  . . .

    Optional expressions whose resultant types correspond to
    conversion specifications given in the format specification.

    If no conversion specifications are given, the output sources can
    be omitted. Otherwise, the function calls must have exactly as
    many output sources as there are conversion specifications, and
    the conversion specifications must match the types of the output
    sources.

    Conversion specifications are matched to output sources in left-
    to-right order. Any excess output sources are ignored.

2  –  Description

    The fwprintf function writes output to the stream pointed to by
    stream under control of the wide-character string pointed to by
    format, which specifies how to convert subsequent arguments to
    output. If there are insufficient arguments for the format, the
    behavior is undefined. If the format is exhausted while arguments
    remain, the excess arguments are evaluated, but are otherwise
    ignored. The fwprintf function returns when it encounters the end
    of the format string.

    The format argument is composed of zero or more directives that
    include:

    o  Ordinary wide characters (not the percent sign (%))

    o  Conversion specifications

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  –  Example

      The following example shows how to print a date and time in the
      form "Sunday, July 3, 10:02", followed by pi to five decimal
      places:

        #include <math.h>
        #include <stdio.h>
        #include <wchar.h>
        /* . . . */
        wchar_t *weekday, *month; /* pointers to wide-character strings */
        int day, hours, min;
        fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",
           weekday, month, day, hour, min);
        fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0));
Close Help