You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Perhaps my misconception, but fast-cpp-csv-parser is not able to parse CSV file with missing separators at rows end. Maybe CSV not exact according standarts, but in practice is often used
test.csv
a;b;c
1;2;3
1;2;
1;2
1;;
1;
1
main.c
int main(int argc, char** argv)
{
io::CSVReader<3, io::trim_chars<' ', '\t'>, io::no_quote_escape<';'>> in("test.csv");
in.read_header(io::ignore_extra_column, "a", "b", "c");
std::string vendor, size, speed;
try {
while(in.read_row(vendor, size, speed)){
// do stuff with the data
}
cout << "ignore_extra_column OK" << endl;
} catch(exception &e) {
cout << "ignore_extra_column BAD" << endl;
}
io::CSVReader<3, io::trim_chars<' ', '\t'>, io::no_quote_escape<';'>> in1("test.csv");
in1.read_header(io::ignore_missing_column, "a", "b", "c");
try {
while(in.read_row(vendor, size, speed)){
// do stuff with the data
}
cout << "ignore_missing_column OK" << endl;
} catch(exception &e) {
cout << "ignore_missing_column BAD" << endl;
}
io::CSVReader<3, io::trim_chars<' ', '\t'>, io::no_quote_escape<';'>> in2("test.csv");
in2.read_header(io::ignore_no_column, "a", "b", "c");
try {
while(in.read_row(vendor, size, speed)){
// do stuff with the data
}
cout << "ignore_no_column OK" << endl;
} catch(exception &e) {
cout << "ignore_no_column BAD" << endl;
}
}
output:
ignore_extra_column BAD
ignore_missing_column BAD
ignore_no_column BAD
The text was updated successfully, but these errors were encountered:
Hate to bring up old issues, but I'm having a very similar issue. I suspect I'm doing something wrong, or missing something essential from the documentation. Was there a solution discussed offline for the above issue?
Perhaps my misconception, but fast-cpp-csv-parser is not able to parse CSV file with missing separators at rows end. Maybe CSV not exact according standarts, but in practice is often used
test.csv
main.c
output:
The text was updated successfully, but these errors were encountered: