| cplusplus.com > reference > cstdio > putchar | 
| 
putchar
 <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.
 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>
int 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