9. Files: Electronic Storage

At some point in your programming career, you’re going to have to deal with disk files. Most real-world applications store and retrieve persistent information, for example, applications such as payroll programs, spreadsheets, and text editors, to name just a few. Even simpler applications often need long-term data storage.

When the program ends, you don’t want this information to vanish into the ether. For example, what if this data was your payroll information or the Kentucky Colonel’s secret fried-chicken recipe? In some cases, you may want it to stick around—for years and years.

Disk files, unlike main memory (or RAM), continue to maintain their state even when the computer is turned off. So, when you need a place ...

Get C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart, Third Edition now with O’Reilly online learning.

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