Storing tricky data from text file into array

I am trying to store data of the following format from a text file into different arrays for each component:

Last name, First name
ID Year

For example:
Griffin, Peter
4737 2012

When I am using ifstream fin as a file handler, is this the correct idea?

getline(fin, lastname[counter], ',');
getline(fin, firstname[counter])
getline(fin, id[counter], ' ');
getline(fin, year[counter]);

In particular would the bold above be correct? I am confused about how to extract the first name without also extracting the comma and the space before the first name.

Thanks!!
Topic archived. No new replies allowed.