Working with Files and Streams
One of the most important parts of the C++ standard library is the input/output (I/O) stream-based library that enables developers to work with files, memory streams, or other types of I/O devices. The first part of this chapter provides solutions to some common stream operations, such as reading and writing data, localization settings, and manipulating the input and output of a stream. The second part of the chapter explores the C++17 filesystem
library, which enables developers to perform operations with the filesystem and its objects, such as files and directories.
The recipes covered in this chapter are as follows:
- Reading and writing raw data from/to binary files
- Reading and writing objects from/to binary files
- Using streams on fixed-size external buffers
- Using localized settings for streams
- Using I/O manipulators to control the output of a stream
- Using monetary I/O manipulators
- Using time I/O manipulators...