Its easy enough to test your loop(s) to
get a line
split a line into comma separated 'variables'
- I'd concentrate on that first ... this though
getline(file, line, '\n');
while (getline(file, line, '\n'))
ok, so, you're going to get a line, immediately discard it and get another line (in the while) - is there a reason for discarding the first line ? I understand if its a 'header' line, but then, you may wish to comment that fact in the code, so that anyone else reading gets the 'why'
this code - Im presuming is just testing
dd.a= stod(vec[0]);
dd.b = stod(vec[1]);
you wouldnt really hard code all the way to vec[9] would you ? you would use a FOR loop for if you were 100% sure there was only ever going to be 10 columns, or, use an iterator on 'vec' - personally, I would use the iterator, keep a count, and if you end up with more than 10 columns stop the run
[edit] ok, I looked back and saw this
typedef struct {
int a=0;
int b=0;
int c=0;
double d=0;
double e=0;
double f=0;
double g=0;
int h=0;
double i=0;
double j=0;
}somenumbers;
is it your intent to parse each line of the 'csv' file into a 'somenumbers' struct ? if so, everything I said still applies - in that case I'd probably still use an iterator/counter to assign from the vec[] to somenumbers, as in
...
switch(fieldNumber) :
case 0 : a = convertToInt(vec[fieldNumber]);
case 1 : b = convertToInt(vec[fieldNumber]);
...
where convertToInt is some function you have to convert from a string to an Int, you'd also need a convertToDouble I guess
[/edit]