C++17 marks another huge milestone in terms of new features. The filesystem library provides a simpler way of interacting with the filesystem. It was inspired by Boost.Filesystem (available since 2003). This recipe will show its basics features.
Understanding the filesystem
How to do it...
In this section, we'll show two examples of the filesystem library by using directory_iterator and create_directories. Although there is definitely more under this namespace, the goal of these two snippets is to highlight their simplicity:
- std::filesystem::directory_iterator: Let's write the following code:
#include <iostream>
#include <filesystem>
int main()
{
for(auto& p: std::filesystem::directory_iterator...