Closed dominique120 closed 2 years ago
I ended up finding a solution by doing the following:
size_t lines = 0;
io::LineReader ln_reader("file.csv");
while (char* line = ln_reader.next_line()) {
++lines;
}
...
for (size_t i = 0; i <= lines; ++i) {
try {
in.read_row(...);
} catch (io::error::too_many_columns::exception) { // or other exceptions
//handle exception
}
}
Is there a way or a function already implemented to be able to count the rows of the file without processing each line first?
This would be very helpful to be able to handle error thrown by
read_row()
individually instead of failing the whole file.