Input, Output and Filesystems

C++17 builds upon the prominent I/O stream library but adding the new filesystem library.

We'll cover the following

Iostream Library

I/O streams library is a library, present from the beginning of C++, that allows communication with the outside world.

Communication means in this concrete case, that the extraction operator (>>) enables it to read formatted or unformatted data from the input stream, and the insertion operator (<<) enables it to write the data on the output stream. Data can be formatted using manipulators.

The stream classes have an elaborate class hierarchy. Two stream classes are significant: First, string streams allow you to interact with strings and streams. Second, file streams allow you to read and write files easily. The state of streams is kept in flags, which you can read and manipulate.

By overloading the input operator and output operator, your class can interact with the outside world like a fundamental data type.

Filesystem Library

In contrast to the I/O streams library, filesystem library was added to the C++ Standard with C++17. The library is based on the three concepts file, file name, and path. Files can be directories, hard links, symbolic links or regular files. Paths can be absolute or relative.

The filesystem library supports a powerful interface for reading and manipulating the filesystem.

In the next lesson, we will talk about multithreading.

Get hands-on with 1400+ tech skills courses.