Input and Output with Disk Files

In all previous examples, the code read input data from the keyboard and sent output data to the screen. This was nice because it allowed you to concentrate on one thing at a time. For real-life applications, this would not do. You should be able to read data produced by other applications and save the results for future use. In this section, we will briefly look at files as yet another technique for handling large sets of data.

C++, similar to other modern languages, does not have built-in input and output operations. What you use for I/O belongs to a library rather than to the language itself. C++ programs can use two libraries, the standard I/O library stdio inherited from C and the newer iostream library ...

Get Core C++ A Software Engineering Approach 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.