
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
#include <stdio.h>
int getchar( void );
#include <wchar.h>
wint_t getwchar( void );
Description:
The getchar function is equivalent to getc with the argument stdin.
The getwchar function is similar to getchar except that it is equivalent
to getwc with the argument stdin.
Returns:
The getchar function returns the next character from the input stream
pointed to by stdin. If the stream is at end-of-file, the end-of-file
indicator is set and getchar returns EOF. If a read error occurs, the
error indicator is set and getchar returns EOF.
The getwchar function returns the next wide character from the input
stream pointed to by stdin. If the stream is at end-of-file, the
end-of-file indicator is set and getchar returns WEOF. If a read error
occurs, the error indicator is set and getchar returns WEOF. If an
encoding error occurs, errno is set to EILSEQ and getchar returns
WEOF.
When an error has occurred, errno contains a value indicating the type
of error that has been detected.
Example:
#include <stdio.h>
void main()
{
FILE *fp;
int c;
fp = freopen( "file", "r", stdin );
while( (c = getchar()) != EOF )
putchar(c);
fclose( fp );
}
Classification:
getchar is ANSI, getwchar is ANSI
Systems:
getchar - All, Netware
getwchar - All
See Also:
fgetc, fgetchar, fgets, fopen, getc, gets, ungetc
See Also:
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson