Chapter Summary
Many programs use getchar() to read input character by character. Typically, systems use line-buffered input, meaning that input is transmitted to the program when you press Enter. Pressing Enter also transmits a newline character that may require programming attention. ANSI C requires buffered input as the standard.
C features a family of functions, called the standard I/O package, that treats different file forms on different systems in a uniform manner. The getchar() and scanf() functions belong to this family. Both functions return the value EOF (defined in the stdio.h header) when they detect the end of a file. UNIX systems enable you to simulate the end-of-file condition from the keyboard by typing Ctrl+D at the beginning ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access