This chapter brings an element of completeness to our exploration of C++. Specifically, it extends the functionality of our applications to a level beyond simply storing variables in volatile system memory. It reaches further and examines how data is loaded to and from files stored on persistent disk storage such as hard disks. It explores how it is possible to save data in applications to a file so it may be used on later occasions. This is important for games because there will be many times when players will want to save and load their progress from session to session. In addition to file saving and loading, the issue of command-line arguments is also considered. This chapter examines the following subjects:
Files and iostream
Read and Write
Get pointer
Command-line arguments