ben-strasser / fast-cpp-csv-parser

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

Unknown column numbers #49

Closed DonaldTrump88 closed 7 years ago

DonaldTrump88 commented 7 years ago

Hello Ben Strasser,

I have CSV files which I want to import. Unfortunately I do not know numbers of columns before(either at compile time or before opening header in CSV file and counting header columns.)

  1. Is it possible to include utility function which will count numbers of columns in CSV header(first row)? I can get value from this function to pass to CSVReader constructor?
  2. Best choice is, CSVReader constructor readers CSV header and find outs number of columns.
ben-strasser commented 7 years ago

If you know the number of columns that you want to actually read then you can use the library. As stated in the documentation, the file may contain additional columns that are ignored. If you do not know the number of columns that you want to read then this is not for you.