Skip to Content
Programming: Principles and Practice Using C++, 3rd Edition
book

Programming: Principles and Practice Using C++, 3rd Edition

by Bjarne Stroustrup
April 2024
Beginner
656 pages
23h 19m
English
Addison-Wesley Professional
Content preview from Programming: Principles and Practice Using C++, 3rd Edition

9

Input and Output Streams

Science is what we have learned about how to keep from fooling ourselves.

– Richard P. Feynman

In this chapter, we present the C++ standard-library facilities for handling input and output from a variety of sources: I/O streams. We show how to read and write files, how to deal with errors, how to deal with formatted input, and how to provide and use I/O operators for user-defined types. This chapter focuses on the basic model: how to read and write individual values, and how to open, read, and write whole files.

§9.1 Input and output

§9.2 The I/O stream model

§9.3 Files

Opening a file; Reading and writing a file

§9.4 I/O error handling

§9.5 Reading a single value

Breaking the problem into manageable parts; Separating ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming: Principles and Practice Using C++, 2nd Edition

Programming: Principles and Practice Using C++, 2nd Edition

Bjarne Stroustrup

Publisher Resources

ISBN: 9780138308667