GETC(3S) GETC(3S) NAME getc, getchar, fgetc, getw - get character or word from stream SYNOPSIS #include int getc(stream) FILE *stream; int getchar() int fgetc(stream) FILE *stream; int getw(stream) FILE *stream; DESCRIPTION _G_e_t_c returns the next character from the named input _s_t_r_e_a_m. _G_e_t_c_h_a_r() is identical to _g_e_t_c(_s_t_d_i_n)_. _F_g_e_t_c behaves like _g_e_t_c, but is a genuine function, not a macro; it may be used to save object text. _G_e_t_w returns the next int (a 32-bit integer on a VAX-11) from the named input _s_t_r_e_a_m. It returns the constant EOF upon end of file or error, but since that is a good integer value, _f_e_o_f and _f_e_r_r_o_r(3S) should be used to check the success of _g_e_t_w. _G_e_t_w assumes no special alignment in the file. SEE ALSO clearerr(3S), fopen(3S), putc(3S), gets(3S), scanf(3S), fread(3S), ungetc(3S) DIAGNOSTICS These functions return the integer constant EOF at end of file, upon read error, or if an attempt is made to read a file not opened by _f_o_p_e_n. The end-of-file condition is remembered, even on a terminal, and all subsequent attempts to read will return EOF until the condition is cleared with _c_l_e_a_r_e_r_r(3S). BUGS Because it is implemented as a macro, _g_e_t_c treats a _s_t_r_e_a_m argument with side effects incorrectly. In particular, ‘getc(*f++);’ doesn’t work sensibly. 7th Edition May 14, 1986 GETC(3S)