HELPLIB.HLB  —  CRTL  fprintf
    Performs formatted output to a specified file.

    Format

      #include  <stdio.h>

      int fprintf  (FILE *file_ptr, const char *format_spec, . . . );

1  –  Arguments

 file_ptr

    A pointer to the file to which the output is directed.

 format_spec

    A pointer to a character string that contains the format
    specification.

  . . .

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

      An example of a conversion specification follows:

        #include <stdio.h>

        main()
        {
           int  temp = 4, temp2 = 17;

           fprintf(stdout, "The answers are %d, and %d.", temp, temp2);
        }

      This example outputs the following to the stdout file:

        The answers are 4, and 17.

3  –  Return Values

    x                  The number of bytes written, excluding the
                       null terminator.
    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.
Close Help