utils/include/file

namespace feasst

Functions

void skip_characters(const char comment, std::ifstream &file)

Skip all lines beginning with character in file.

bool find(const char *search_string, std::ifstream &file)

Skip all lines in file until reaching a certain line with search_string. Return 1 if found.

bool find(const std::string search_string, std::ifstream &file)
void find_or_fail(const char *search_string, std::ifstream &file)

Same as find except terminate if search_string is not found.

bool file_exists(const std::string &file_name)

Return true if file exists.

void file_backup(const std::string &file_name, const std::string append = ".bak")

If file_name exists, rename file with appended string.