Commit | Line | Data |
---|---|---|
8bb980a3 C |
1 | GETC(3) BSD Programmer's Manual GETC(3) |
2 | ||
3 | N\bNA\bAM\bME\bE | |
4 | f\bfg\bge\bet\btc\bc, g\bge\bet\btc\bc, g\bge\bet\btc\bch\bha\bar\br, g\bge\bet\btw\bw - get next character or word from input stream | |
5 | ||
6 | S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS | |
7 | #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bst\btd\bdi\bio\bo.\b.h\bh>\b> | |
8 | ||
9 | _\bi_\bn_\bt | |
10 | f\bfg\bge\bet\btc\bc(_\bF_\bI_\bL_\bE _\b*_\bs_\bt_\br_\be_\ba_\bm); | |
11 | ||
12 | _\bi_\bn_\bt | |
13 | g\bge\bet\btc\bc(_\bF_\bI_\bL_\bE _\b*_\bs_\bt_\br_\be_\ba_\bm); | |
14 | ||
15 | _\bi_\bn_\bt | |
16 | g\bge\bet\btc\bch\bha\bar\br(); | |
17 | ||
18 | _\bi_\bn_\bt | |
19 | g\bge\bet\btw\bw(_\bF_\bI_\bL_\bE _\b*_\bs_\bt_\br_\be_\ba_\bm); | |
20 | ||
21 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN | |
22 | The f\bfg\bge\bet\btc\bc() function obtains the next input character (if present) from | |
23 | the stream pointed at by _\bs_\bt_\br_\be_\ba_\bm, or the next character pushed back on the | |
24 | stream via ungetc. | |
25 | ||
26 | The g\bge\bet\btc\bc() function acts essentially identically to f\bfg\bge\bet\btc\bc(), but is a | |
27 | macro that expands in-line. | |
28 | ||
29 | The g\bge\bet\btc\bch\bha\bar\br() function is equivalent to: getc with the argument stdin. | |
30 | ||
31 | The g\bge\bet\btw\bw() function obtains the next _\bi_\bn_\bt (if present) from the stream | |
32 | pointed at by _\bs_\bt_\br_\be_\ba_\bm. | |
33 | ||
34 | R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS | |
35 | If successful, these routines return the next requested object from the | |
36 | _\bs_\bt_\br_\be_\ba_\bm. If the stream is at end-of-file or a read error occurs, the rou- | |
37 | tines return EOF. The routines feof(3) and ferror(3) must be used to dis- | |
38 | tinguish between end-of-file and error. If an error occurs, the global | |
39 | variable _\be_\br_\br_\bn_\bo is set to indicate the error. The end-of-file condition | |
40 | is remembered, even on a terminal, and all subsequent attempts to read | |
41 | will return EOF until the condition is cleared with clearerr. | |
42 | ||
43 | S\bSE\bEE\bE A\bAL\bLS\bSO\bO | |
44 | ferror(3), fread(3), fopen(3), putc(3), ungetc(3) | |
45 | ||
46 | S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS | |
47 | The f\bfg\bge\bet\btc\bc(), g\bge\bet\btc\bc() and g\bge\bet\btc\bch\bha\bar\br() functions conform to ANSI C X3.159-1989 | |
48 | (``ANSI C ''). | |
49 | ||
50 | B\bBU\bUG\bGS\bS | |
51 | Since EOF is a valid integer value, feof and ferror must be used to check | |
52 | for failure after calling g\bge\bet\btw\bw(). The size and byte order of an _\bi_\bn_\bt | |
53 | varies from one machine to another, and g\bge\bet\btw\bw() is not recommended for | |
54 | portable applications. | |
55 | ||
56 | 4.4BSD June 4, 1993 1 |