I encountered an issue when attempting to parse a specific CSV file using the csv-parser library.
When providing the file as input, the following error is thrown and the program crashes:
$ g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ sample.cpp
$ ./a.out >/dev/null
terminate called after throwing an instance of 'std::error_code'
Aborted (core dumped)
This issue has been observed on an Ubuntu 22.04 LTS system.
sample.cpp
#include "single_include/csv.hpp"
int main() {
csv::CSVReader reader{"sample.csv", csv::CSVFormat{}.no_header()};
for (csv::CSVRow &row : reader) {
for (csv::CSVField &field : row)
std::cout << field.get() << " ";
std::cout << std::endl;
}
}
sample.csv