Chapter 10

Working with Files

Chapter 9 introduced dvdTracker, a program designed to keep track of your DVD collection. dvdTracker allowed you to enter a new DVD, as well as list all existing DVDs. dvdTracker's biggest shortcoming was that it didn't save the DVD information when it exited. If you ran dvdTracker, entered information on ten DVDs and then quit, your information would be gone. The next time you ran dvdTracker, you'd have to start from scratch.

The solution to this problem is to somehow save all of the DVD information before you quit the program. This chapter will show you how; it introduces the concept of files, the long-term storage for your program's data. We'll start off with the basics, learning how to open and read a file and ...

Get Learn C on the Mac now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.