putchar
int  putchar (int character );
stdio.h
cplusplus.com

Write character to stdout.
  Writes character to the current position in the standard output (stdout) and increases the file pointer to point to next character.
  This routine cooresponds to: putc(character,stdout).

Parameters.

character
Character to be written. Although it is declared as int, the function converts it to unsigned char before write it.

Return Value.
  The value returned is the written character. If an error occurs, EOF is returned.
  Note that when you work with binary files EOF is a valid character and you must use ferror() function to check if it has been an error.

Portability.
  Defined in ANSI-C. K&R compatible.

Example.

/* putchar example: printing alphabet */
#include <stdio.h>

main()
{
  char c;
  for (c = 'A' ; c <= 'Z' ; c++) {
    putchar (c);
    }
  return 0;
}
  This program writes ABCDEFGHIJKLMNOPQRSTUVWXYZ on the standard output (screen).

See also.
  putc, fputc, getchar


© The C++ Resources Network, 2000