/** * Linux/Windows friendly way to check if a file exists */ bool General::fexists(const std::string &filename) { ifstream ifile(filename.c_str()); return ifile.is_open(); }
/*! * Check whether a file exists. * from https://techoverflow.net/blog/2013/01/11/cpp-check-if-file-exists/ * * \param filename The path to a filename to check if it exists * \return Whether the file exists. */ bool fexists(const char *filename) { std::ifstream ifile(filename); return (bool)ifile; }