O'Reilly logo

C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart, Second Edition by Brian Overland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8. Files: Electronic Storage

Most practical applications (reservation systems, database systems, spreadsheets, and even games) store and retrieve persistent information. This is data that hangs around after the program ends and even after the computer is turned off.

Main memory (RAM) is not persistent. As soon as the computer is turned off, data in memory is lost forever. But even if main memory were more permanent—even if it didn’t zero out when the computer shuts down—main memory is too precious a resource to be dedicated to long-term record storage.

So when you need a place to put data for later use, put it in a disk file.

Introducing File-Stream Objects

In using cin and cout (console input and output), you’ve already made use of objects. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required