getc(3s)getc(3s)Name
getc, getchar, fgetc, getw - get character or word from stream
Syntax
#include <stdio.h>
int getc(stream)
FILE *stream;
int getchar()
int fgetc(stream)
FILE *stream;
int getw(stream)
FILE *stream;
Description
The function returns the next character from the named input stream.
The function is identical to (stdin).
The function behaves like but is a genuine function, not a macro. It may be used to save object text.
The function returns the next word (in a 32-bit integer on a VAX-11 or MIPS machine) from the named input stream. It returns the constant
EOF upon end of file or error, but since that is a good integer value, feof and should be used to check the success of The assumes no spe-
cial alignment in the file.
Restrictions
Because it is implemented as a macro, treats a stream argument with side effects incorrectly. In particular, `getc(*f++);' doesn't work as
expected.
Diagnostics
These functions return the integer constant EOF at end of file or upon read error.
A stop with message, `Reading bad file', means an attempt has been made to read from a stream that has not been opened for reading by
See Alsofopen(3s), fread(3s), gets(3s), putc(3s), scanf(3s), ungetc(3s)getc(3s)
Check Out this Related Man Page
getc(3s)getc(3s)Name
getc, getchar, fgetc, getw - get character or word from stream
Syntax
#include <stdio.h>
int getc(stream)
FILE *stream;
int getchar()
int fgetc(stream)
FILE *stream;
int getw(stream)
FILE *stream;
Description
The function returns the next character from the named input stream.
The function is identical to (stdin).
The function behaves like but is a genuine function, not a macro. It may be used to save object text.
The function returns the next word (in a 32-bit integer on a VAX-11 or MIPS machine) from the named input stream. It returns the constant
EOF upon end of file or error, but since that is a good integer value, feof and should be used to check the success of The assumes no spe-
cial alignment in the file.
Restrictions
Because it is implemented as a macro, treats a stream argument with side effects incorrectly. In particular, `getc(*f++);' doesn't work as
expected.
Diagnostics
These functions return the integer constant EOF at end of file or upon read error.
A stop with message, `Reading bad file', means an attempt has been made to read from a stream that has not been opened for reading by
See Alsofopen(3s), fread(3s), gets(3s), putc(3s), scanf(3s), ungetc(3s)getc(3s)
Hello everybody,
I have a C program that uses getc to read messages from the stdin. It stops when it receives an EndOfMessage or EndOfTransmission char (0x03 or 0x04).
while ((c = getc(stdin)) && !IsEndChar(c) && (iMsgLen < MAX_LEN_MESSAGE))
{
\\treatment
....... (1 Reply)
Hi I need help with some function. I have to fetch data from stdin without using of scanf() (I have to use getc or getchar) and then each sign I want to convert to another sign - here I can't use function strtol :( . In the end i want to print this string to stdout without using of function printf... (3 Replies)
Hi, I'm connected remotely to a unix machine and my machine is running windows and I'm trying to write a C program that's taking input from stdin. How do I enter the 'EOF' character from my keyboard? (in UNIX it would be ctrl-D). I read somewhere that its ctrl-Z, but when I do that the window... (2 Replies)
Im a newbie to programming language, i found tat there r these function called printf and putchar() as well as scanf and getchar(), im curious abt why do dey hav these 2 different function although dey r doing the same instruction? :confused: (13 Replies)