storing file data in an arrary

I have a structure
struct Wine
{
string wineName;
int vintage;
int rating;
double price;
};

how can i store the file data below in an array with the structure type???

Dow Vintage Port ; 2011 ; 99 ; 82
Mollydooker Shiraz Carnival of Love ; 2012 ; 95 ; 75
Prats & Symington Douro Chryseia ; 2011 ; 97 ; 55
Quinta do Vale Meão Douro ; 2011 ; 97 ; 76
Leeuwin Chardonnay River Art Series ; 2011 ; 96 ; 89


You should store data in a file as you show in example.

then
1) read data line by line using readline() or similar fun.
2) use strtok (cstring)fun for tokenize and ; as a delimiters
3)store 1st token value into wineName, 2nd into vintage, so on.
4) repeat step 1 to 4 until eof;
Topic archived. No new replies allowed.