How to read from a csv file please need help

I have no idea about csv files and it is showing. Alittle code snippet is

while(x<3){
getline(customer, line); //get the customer info in a csv using getline
user[x]=line; //store that value in an array
x++;
}

pos=user[0].find(", "); //find the next instance of ", "

cout<<user[0]<<endl; //testing that line was stored correctly

test = user[0].substr(pos); //store the result of the find in test

cout<<test;

the only problem is I want it to print from 1 comma to the next not displaying the comma but a result would be like

, 100 Evergreen Ter, Springfield, Somestate, 11111

Not
Homer Simpson

How would I go about getting the Homer Simpson then the 100 Evergreen Ter etc... Thanks for your help
You may get some tips from this post where getline is used with a ',' as a delimiter to read csv.

http://www.cplusplus.com/forum/beginner/69171/
Last edited on
Topic archived. No new replies allowed.