Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getc(3s) [ultrix 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 Also
       fopen(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 Also
       fopen(3s), fread(3s), gets(3s), putc(3s), scanf(3s), ungetc(3s)

																	  getc(3s)
Man Page

4 More Discussions You Might Find Interesting

1. Programming

getc(stdin) receives bad message. PLEASE HELP !!

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)
Discussion started by: Majid
1 Replies

2. Programming

convert without using strtol

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)
Discussion started by: BMW750LIuser
3 Replies

3. UNIX for Dummies Questions & Answers

How to input EOF from Windows connected to Unix maxhine via SSH

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)
Discussion started by: sayeo
2 Replies

4. Programming

What is the difference between printf and putchar() or scanf and getchar() ?

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)
Discussion started by: kris26
13 Replies