Creating and Deleting Directories in C++

Creating and Deleting Directories in C++

1. Description If the compiler supports C++17, it is recommended to use the <span>std::filesystem</span> related functions If used only on Windows platform, you can use <span>_mkdir</span> and <span>_rmdir</span> If used only on Linux platform, you can use <span>mkdir</span> and <span>rmdir</span> If the code needs to be cross-platform, you can use system calls to unify If … Read more

C++ std::filesystem: Elegantly Handling Files and Paths

C++ std::filesystem: Elegantly Handling Files and Paths

Handling files and paths is a frequent task in any programming language. In C++, we used to rely on platform-specific APIs (such as CreateFile on Windows or open in POSIX) to accomplish this. This approach was not only cumbersome but also required consideration of cross-platform compatibility issues. The good news is that with the introduction … Read more