To check if a file exists in C++ you can use the following snippet.
Sample C++
#include <sys/stat.h> inline bool fileExists (const std::string& fileName) { struct stat buff; return (stat (fileName.c_str(), &buff) == 0); }
All the Code Snippets and Samples you need
To check if a file exists in C++ you can use the following snippet.
#include <sys/stat.h> inline bool fileExists (const std::string& fileName) { struct stat buff; return (stat (fileName.c_str(), &buff) == 0); }
You must be logged in to post a comment.
RT @CodeSnippetsNET: Check if a file exists in #C++ http://t.co/zDxVBzYBh5 #cplusplus #programming #code #develop