Since C++17 filesystem library is available and you should use this library. It provides std::filesystem::exists() call