GETC(3S) UNIX Programmer's Manual 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 word 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(3) 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 fopen(3), putc(3), gets(3), scanf(3), fread(3), ungetc(3) 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 _f_o_p_e_n. BUGS The end-of-file return from _g_e_t_c_h_a_r is incompatible with that in UNIX editions 1-6. 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. Printed 9/10/82 1