Chapter    11

Working With Files

Chapter 10 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 so it can be used again the next time you run it. This is called persistence. This chapter will show you how to implement persistence. It introduces the concept of files, the long-term ...

Get Learn C on the Mac: For OS X and iOS, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.