#include <stdio.h>
int getc(stream) FILE *stream;
int getchar()
int fgetc(stream) FILE *stream;
int getw(stream) FILE *stream;
getc() returns the next character (that is, byte) from the named input stream, as an integer. It also moves the file pointer, if defined, ahead one character in stream. getchar() is defined as getc(stdin). getc() and getchar() are macros.
fgetc() behaves like getc(), but is a function rather than a macro. fgetc() runs more slowly than getc(), but it takes less space per invocation and its name can be passed as an argument to a function.
getw() returns the next C int (word) from the named input stream. getw() increments the associated file pointer, if defined, to point to the next word. The size of a word is the size of an integer and varies from machine to machine. getw() assumes no special alignment in the file.
On success, getc(), getchar() and fgetc() return the next character from the named input stream as an integer. On failure, or on EOF, they return EOF. The EOF condition is remembered, even on a terminal, and all subsequent operations which attempt to read from the stream will return EOF until the condition is cleared with clearerr() (see ferror.3v
getw() returns the next C int from the named input stream on success. On failure, or on EOF, it returns EOF, but since EOF is a valid integer, use ferror.3v to detect getw() errors.
On failure, or on EOF, these functions return EOF. The EOF condition is remembered, even on a terminal, however, operations which attempt to read from the stream will ignore the current state of the EOF indication and attempt to read from the file descriptor associated with the stream.
If the integer value returned by getc(), getchar(), or fgetc() is stored into a character variable and then compared against the integer constant EOF, the comparison may never succeed, because sign-extension of a character on widening to integer is machine-dependent.
Because of possible differences in word length and byte ordering, files written using putw() are machine-dependent, and may not be readable using getw() on a different processor.
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97