1 #ifndef FILE_READER_HPP
2 #define FILE_READER_HPP
13 void open(
const std::string& input){
15 ifile = std::ifstream(input, std::ios::in);
18 if (!
ifile.is_open()) {
19 std::cerr <<
"There was a problem opening the input file '" << input <<
"'.\n";
32 while (i<n && ifile >> num) {
39 std::cerr <<
"Error parsing file '" <<
filename <<
"': Reached end of file, but more data was expected!\n";
50 while (i<n && ifile >> num) {
56 std::cerr <<
"Error parsing file '" <<
filename <<
"': Reached end of file, but more data was expected!\n";
69 for(
int i=0; i<n; i++){
void read(T *var, int n)
Definition: file_reader.hpp:28
std::ifstream ifile
Definition: file_reader.hpp:8
void skip_lines(int n)
Definition: file_reader.hpp:68
std::string filename
Definition: file_reader.hpp:9
Definition: file_reader.hpp:6
void skip_line()
Definition: file_reader.hpp:62
void skip(int n)
Definition: file_reader.hpp:45
void open(const std::string &input)
Definition: file_reader.hpp:13