cplusplus.com
  C++ Library Reference : C Library : cstdio (stdio.h) : putchar
- -
º¯Êý¿â
C++º¯Êý¿â
Cº¯Êý¿â
C++º¯Êý¿â
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
C Library
cassert (assert.h)
cctype (ctype.h)
cerrno (errno.h)
cfloat (float.h)
climits (limits.h)
clocale (locale.h)
cmath (math.h)
csetjmp (setjmp.h)
csignal (signal.h)
cstdarg (stdarg.h)
cstddef (stddef.h)
cstdio (stdio.h)
cstdlib (stdlib.h)
cstring (string.h)
ctime (time.h)
cstdio (stdio.h)
functions:
· clearerr
· fclose
· feof
· ferror
· fflush
· fgetc
· fgetpos
· fgets
· fopen
· fprintf
· fputc
· fputs
· fread
· freopen
· fscanf
· fseek
· fsetpos
· ftell
· fwrite
· getc
· getchar
· gets
· perror
· printf
· putc
· putchar
· puts
· remove
· rename
· rewind
· scanf
· setbuf
· setvbuf
· sprintf
· sscanf
· tmpfile
· tmpnam
· ungetc
· vfprintf
· vprintf
· vsprintf
macro constants:
· EOF
· FILENAME_MAX
· NULL
· TMP_MAX
objects:
· stderr
· stdin
· stdout
types:
· FILE
· fpos_t
· size_t

-

putchar function
int putchar ( int character );
<cstdio>

Write character to stdout

Writes character to the current position in the standard output (stdout) and advances the internal file position indicator to the next position.
It is equivalent to putc(character,stdout).

Parameters

character
Character to be written. The character is passed as its int promotion.

Return Value

If there are no errors, the same character that has been written is returned.
If an error occurs, EOF is returned and the error indicator is set.

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 to the standard output.

See also

putc Write character to stream (function)
fputc Write character to stream (function)
getchar Get character from stdin (function)
© Copyright © 2007-2008 ¿áÇÚÍø All Rights Reserved