yanlinlin82 / csv-parser-cplusplus

Automatically exported from code.google.com/p/csv-parser-cplusplus
GNU General Public License v3.0
0 stars 0 forks source link

Fails to parse last line of CSV if it isn't terminated with a new line #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a CSV that doesn't have a new line at the bottom
2. Attempt to parse
3. Notice that the last column of the last row isn't read

What is the expected output? What do you see instead?
Each and every row/column correctly parsed.

What version of the product are you using? On what operating system?
Windows 7 Professional 64 bit

Please provide any additional information below.
This can be fixed via the attached patch. Essentially, when the last line is 
read (EOF character is detected), the code should increment current position, 
as we then allocate a buffer based on the line length, and as later code 
expects there to be a line terminator, we add the line terminator in in the 
second from last character (last character is NULL terminator, second from last 
EOL and previous characters are read from file).

Original issue reported on code.google.com by st...@pawprintgames.com on 24 Oct 2014 at 9:56

Attachments: