[Previous]
[Contents]
[Next]

putchar()

write a character to stdout

Synopsis:

#include <stdio.h>

int putchar( int c );

Description:

The putchar() function writes the character specified by the argument c to the output stream stdout. It's equivalent to

fputc( c, stdout );

Returns:

The character written. If a write error occurs, errno is set, and putchar() returns EOF.

Examples:

#include <stdio.h>

void main()
  {
    FILE *fp;
    int c;

    fp = fopen( "file", "r" );
    c = fgetc( fp );
    while( c != EOF ) {
      putchar( c );
      c = fgetc( fp );
    }
    fclose( fp );
  }

Classification:

ANSI

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

errno, ferror(), fopen(), fputc(), fputchar(), fputs(), putc()


[Previous]
[Contents]
[Next]