is there a good and free implementation of CSV parser available under some liberal licence? Some counterpart of SuperCSV for Java, perhaps a port?
In C#, StreamReader class is used to deal with the files. It opens, reads and helps in performing other functions to different types of files. We can also perform different operations on a CSV file while using this class. OpenRead() method is used to open a CSV file and ReadLine() method is used to read its contents.
You need to parse the CSV file. My guess is that you can assume that none of the CSV fields contain a ',' or a newline. If so, then parsing is simple: just read line by line using std::getline into a std::string, then parse the string into tokens with ',' as the delimiter.
A CSV (comma-separated values) file is a text file that has a specific format which allows data to be saved in a table structured format.
FileHelpers Open Source Library.
There's a nice implementation on CodeProject:
To give more down to earth numbers, with a 45 MB CSV file containing 145 fields and 50,000 records, the reader was processing about 30 MB/sec. So all in all, it took 1.5 seconds! The machine specs were P4 3.0 GHz, 1024 MB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With