In a project I'm working on, I need to read from a CSV file, update a field on each row, and then save the results back to the CSV file. I'm looking for a library that will help me with this.
My first attempt was to use ADO. This worked like a charm for reading, but when I attempted to update the file I received the error "Updating data in a linked table is not supported by this ISAM."
So now I'm looking for a replacement (or workaround). These are my requirements:
I would rather not define every column in the file. I only need two columns, and am concerned that additional columns may be added at a future date.
I need to be able to preserve (or, at the very least, replicate) the column heading information.
I would prefer to have as little knowledge of the underlying format/file as possible (i.e. I don't want to write a CSV writer from scratch).
I've run across a number of alternative readers, and a couple of writers... But the writers all involve reading the CSV file into a pre-defined set of fields, and then writing only those fields back to the new file. I want to minimize the amount of information about the column structure hard coded into my program.