Error Handling & File Races
Explore how C++17's filesystem library manages error handling through exceptions and error codes. Understand the risks of file races when multiple processes access files concurrently, and learn practical ways to use the filesystem API safely.
We'll cover the following...
We'll cover the following...
So far the examples in this chapter used exception handling as a way to report errors. The filesystem API is also equipped with function and method overloads that outputs an error code.
You can decide if you want exceptions or error codes.
For example, we have two overloads for file_size ...