Header File
stdio.h
Category
Console I/O Routines
Prototype
int getchar(void);
wint_t getwchar(void);
Description
Gets character from stdin.
getchar is a macro that returns the next character on the named input stream stdin. It is defined to be getc(stdin).
On success, getchar returns the character read, after converting it to an int without sign extension.
On end-of-file or error, it returns EOF.
Example
#include <stdio.h> int main(void) { int c; /* Note that getchar reads from stdin and is line buffered; this means it will not return until you press ENTER. */ while ((c = getchar()) != '\n') printf("%c", c); return 0; }
Portability
|
POSIX |
Win32 |
ANSI C |
ANSI C++ |
getchar |
+ |
+ |
+ |
+ |
getwchar |
|
+ |
+ |
+ |
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|