1

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?

Community
  • 1
  • 1
einpoklum
  • 118,144
  • 57
  • 340
  • 684

1 Answers1

1

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

David D
  • 1,571
  • 11
  • 12
  • Can you see something about its merits? I assume it does conform to RFC 4180, but - is it reasonably speedy? It's not very standard-library-like from the looks of it. Also, does it not require the 'ragel' tool? – einpoklum Apr 13 '16 at 21:13