1 #ifndef FILE_READER_HPP
2 #define FILE_READER_HPP
14 void open(
const std::string& input){
16 ifile = std::ifstream(input, std::ios::in);
19 if (!
ifile.is_open()) {
20 std::cerr <<
"There was a problem opening the input file '" << input <<
"'.\n";
33 while (i<n && ifile >> num) {
40 std::cerr <<
"Error parsing file '" <<
filename <<
"': Reached end of file, but more data was expected!\n";
51 while (i<n && ifile >> num) {
57 std::cerr <<
"Error parsing file '" <<
filename <<
"': Reached end of file, but more data was expected!\n";
70 for(
int i=0; i<n; i++){
void read(T *var, int n)
Definition: file_reader.hpp:29
std::ifstream ifile
Definition: file_reader.hpp:9
void skip_lines(int n)
Definition: file_reader.hpp:69
std::string filename
Definition: file_reader.hpp:10
Definition: file_reader.hpp:7
void skip_line()
Definition: file_reader.hpp:63
void skip(int n)
Definition: file_reader.hpp:46
void open(const std::string &input)
Definition: file_reader.hpp:14