Reading a .csv file

I have to read a .csv file that contains Frequency, amplitude and duration in each line separated by commas.
My code looks like,

while(!infile.eof()){

string F;
.....
.....
// condes
// codes

}

The problem I am having is that it reads the last line twice and I don't know why that happens. Is there any other way I can read the .csv file accurately?
Answer with explanation would be greatly appreciated.
Start reading here
http://www.cplusplus.com/forum/lounge/85957/#msg461345

Hope this helps!
Topic archived. No new replies allowed.