VMS Help  —  CRTL  putc
    The putc macro writes a single character to a specified file.

    Format

      #include  <stdio.h>

      int putc  (int character, FILE *file_ptr);

1  –  Arguments

 character

    The character to be written.

 file_ptr

    A file pointer to the output stream.

2  –  Description

    The putc macro writes the byte character (converted to an
    unsigned char) to the output specified by the file_ptr parameter.
    The byte is written at the position at which the file pointer
    is currently pointing (if defined) and advances the indicator
    appropriately. If the file cannot support positioning requests,
    or if the output stream was opened with append mode, the byte is
    appended to the output stream.

    Since putc is a macro, a file pointer argument with side effects
    (for example, putc (ch, *f++)) might be evaluated incorrectly. In
    such a case, use the fputc function instead.

    Compiling with the __UNIX_PUTC macro defined enables an
    optimization that uses a faster, inlined version of this
    function.

    See also putc_unlocked.

3  –  Return Values

    x                  The character written to the file. Indicates
                       success.
    EOF                Indicates output errors.
Close Help