ben-strasser / fast-cpp-csv-parser

fast-cpp-csv-parser
BSD 3-Clause "New" or "Revised" License
2.11k stars 440 forks source link

Attempting to read CSV with Large header, error C2338: too many columns specified #63

Closed Dan-Bird112 closed 6 years ago

Dan-Bird112 commented 6 years ago

I have tried to read a CSV with 28 coloumns and the error C2338: too many columns specified was thrown.

Is it possible to read large headers with this?

io::CSVReader<3> in(FILE_PATH);

in.read_header(io::ignore_extra_column, "event-id", "visible", "timestamp", "location-long", "location-lat", "acceleration-raw-x", "acceleration-raw-y", "acceleration-raw-z", "algorithm-marked-outlier", "external-temperature", "flt:switch", "gps:hdop", "gps:maximum-signal-strength", "gps:satellite-count", "ground-speed", "gsm:mcc-mnc", "heading", "height-above-ellipsoid", "import-marked-outlier", "location-error-numerical", "tag-voltage", "transmission-timestamp", "vertical-error-numerical", "sensor-type", "individual-taxon-canonical-name", "tag-local-identifier", "individual-local-identifier", "study-name");

in.read_row(event_id, visible, timestamp, location_long, location_lat, acceleration_raw_x, acceleration_raw_y, acceleration_raw_z, algorithm_marked_outlier, external_temperature, flt_switch, gps_hdop, gps_maximum_signal_strength, gps_satellite_count, ground_speed, gsm_mcc_mnc, heading, height_above_ellipsoid, import_marked_outlier, location_error_numerical, tag_voltage, transmission_timestamp, vertical_error_numerical, sensor_type, individual_taxon_canonical_name, tag_local_identifier, individual_local_identifier, study_name);

cout << event_id; 

Thanks

ben-strasser commented 6 years ago

Hi,

you probably have a comma in one of your data elements that is interpreted as separator.

Best Regards Ben Strasser

On 03/21/2018 11:46 AM, Dan-Bird112 wrote:

I have tried to read a CSV with 28 coloumns and the error C2338: too many columns specified was thrown.

Is it possible to read large headers with this?

|io::CSVReader<3> in(FILE_PATH); in.read_header(io::ignore_extra_column, "event-id", "visible", "timestamp", "location-long", "location-lat", "acceleration-raw-x", "acceleration-raw-y", "acceleration-raw-z", "algorithm-marked-outlier", "external-temperature", "flt:switch", "gps:hdop", "gps:maximum-signal-strength", "gps:satellite-count", "ground-speed", "gsm:mcc-mnc", "heading", "height-above-ellipsoid", "import-marked-outlier", "location-error-numerical", "tag-voltage", "transmission-timestamp", "vertical-error-numerical", "sensor-type", "individual-taxon-canonical-name", "tag-local-identifier", "individual-local-identifier", "study-name"); in.read_row(event_id, visible, timestamp, location_long, location_lat, acceleration_raw_x, acceleration_raw_y, acceleration_raw_z, algorithm_marked_outlier, external_temperature, flt_switch, gps_hdop, gps_maximum_signal_strength, gps_satellite_count, ground_speed, gsm_mcc_mnc, heading, height_above_ellipsoid, import_marked_outlier, location_error_numerical, tag_voltage, transmission_timestamp, vertical_error_numerical, sensor_type, individual_taxon_canonical_name, tag_local_identifier, individual_local_identifier, study_name); cout << event_id; |

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ben-strasser/fast-cpp-csv-parser/issues/63, or mute the thread https://github.com/notifications/unsubscribe-auth/ALaAj58ZLX1vqEjZGJSJA7b-s0q9Hh8Nks5tgi93gaJpZM4SzV00.

Dan-Bird112 commented 6 years ago

I have found out that the constructor for the CSVReader was incorrect.

It should have been io::CSVReader<NUM_COL> in(FILE_PATH);