Previous: 8.2 Formatted Input/Output
Up: 8 Functions and Files
Next: 8.4 Common Errors
Previous Page: 8.2.2 Formatted Input: scanf()
Next Page: 8.3.1 Character I/O

8.3 Direct I/O with Files

So far all our programs have used standard files for input and output; normally the keyboard and screen. Unless the standard files are redirected, users must enter data as needed, which may become inconvenient or impractical as the amount of data gets large. However, if redirection is used to read input data from other files, then ALL input must come from redirected files; which means the programs cannot interact with the user. Practical programs require the ability to use files for I/O as well as to interact with users via standard files. For example, data may be needed repeatedly, by different programs, over a period of time. Such data should be stored in files on disks or other peripheral devices, and programs should be able to retrieve data from these files as needed. In addition, programs can save useful data into files for later use.

In this Section, we describe some variations on our previous Input/Output routines which behave similarly, but access data directly from or to files.


tep@wiliki.eng.hawaii.edu
Wed Aug 17 09:15:23 HST 1994