#include <sys/stat.h> bool fileExists(const char *filename) { struct stat sb; return stat(filename, &sb) == 0; }
This can be use to check if a directory or other non-file item exists too.
#include <sys/stat.h> bool fileExists(const char *filename) { struct stat sb; return stat(filename, &sb) == 0; }
This can be use to check if a directory or other non-file item exists too.