0

Hi all,
Can you please tell me how to read .csv files in C++/VC++??
I converted my excel files to .csv files in order to make reading easy.

Need help regarding the code.

Thanks
Rishi.

3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by flavour_of_bru
0

From what I can glean from wikipedia a csv file is just like a normal text file. For reading and writing file info click here

0

I presume each word separated by a comma, will represent a variable in a class declaration.

For example,
.csv file

Sugar, Big jugs, slightly kooky, 18,

Might be represented as

class Hoe
{
 string name;
 string description;
 string intelligence;
 int age;
}

You can use the comma as a delimiter to parse the string into tokens and assign them to your class variables.

Also, regarding Sturm's link to reading files, might be slightly dubious due to !myfile.EOF. Although I just read it briefly so it might be ok. That website is normally good.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.