How should I read and parse (real, proper, full-featured) CSVs in C++?

104 views Asked by At

I've read:

How can I read and parse CSV files in C++?

but the title there is rather misleading. It's not asking about reading CSVs per se, just multi-line comma-delimited no-escaped-data files.

Now, I want to parse actual CSVs - the proper format (RFC 4180-compliant) - with quoted fields and with line breaks, commas and double-quotes within quoted fields; and with at least the option of expecting CRLF as a record delimiter rather than LF.

To be more specific: Can I extend the boost-tokenizer-based suggestions from the simpler version of the question to handle quoting (and the other issues) properly?

1

There are 1 answers

1
David D On

I'd strongly consider using a preexisting library. The first one I found on google that looked reasonable was librfc4180csv.