Sams Teach Yourself C in 21 Days

(singke) #1

DAY 16


WEEK 3


Using Disk Files


Most of the programs you write will use files written to a hard drive. These
files will contain information that will serve one purpose or another: data stor-
age, configuration information, and so on. Today you will learn


  • How to relate streams to disk files

  • About C’s two disk file types

  • The commands for opening a file

  • How to write data to a file

  • Reading data from a file

  • When to close a file

  • Disk file management

  • Using temporary files


Relating Streams to Disk Files ..........................................................................


As you learned on Day 14, “Working with the Screen, Printer, and Keyboard,”
C performs all input and output, including disk files, by means of streams. You
saw how to use C’s predefined streams that are connected to specific devices

26 448201x-CH16 8/13/02 11:13 AM Page 439

Free download pdf