|
|
getline( yourfilestream, astring, ',' );
to get the values. Then you can easily remove the quotes from astring
|
|
DSV files are deceptively simple. They are organized by four rubrics. * A file is a listing of records which are separated by record separator character(s). Typically a record separator is the newline character(s) typical for your platform. Blank lines are ignored. * Each record is composed of fields which are separated by the field separator character. Typically this is a comma or a horizontal tab character. Blank fields are not ignored. * Each field may be surrouned by field padding characters. Typically this is any sequence of whitespace characters not found in the record separator or field separator. Internal field padding is preserved. Blank lines may contain field padding. * The contents of the field may be quoted using a field delimiter character. Typically this is the double-quote ("). What this means is a field may contain any sequence of characters, including record separators, field separators, field padding, and field delimiter characters —even binary data! To use the field delimiter in the field, it must be doubled: For example: "He said ""Hello""" Decoded, this field contains the sequence: He said "Hello" And that's it! |
Well, there is one further consideration. C and C++ programmers are accustomed to using certain character sequences in textual data to represent unprintable or otherwise unusable characters. This has often resulted in DSV files that use those same character sequences. So, we'll have to add a fifth rubric: * It is possible that a field contain escape sequences. Escapes are not constrained by field delimiters. The escape sequences are described in more detail below, but here are two ways a C or C++ programmer would expect to encode the previous example: "He said \"Hello\"" (using the field delimiter) He said \"Hello\" (without using the field delimiter) |