getc
raw OCR
Gets character from stream.
Defined in header <stdio.h>
Syntax
#include <stdio.h>
int getc(FILE *stream);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ | ■ |
Remarks
getc is a macro that returns the next character on the given input stream and increments the stream's file pointer to point to the next character.
Return value
On success, getc returns the character read, after converting it to an int without sign extension. On end-of-file or error, it returns EOF.
See also
Example
#include <stdio.h>
int main(void)
{
char ch;
printf("Input a character:");
/* read a character from the standard input stream */
ch = getc (stdin);
printf("The character input was: '%c'\n", ch);
return
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/stdio.h/getc/
· short form /3.1/getc/