Output problem ?
Ok the following code is supposedc to open a csv file read it then use cout to print the game type and file name for each file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
void Clist()
{
string triviaName;
string fileName;
end = "end";
fIn.open("list.csv");
while(!fIn.eof())
{
getline( fIn, triviaName, ',' );
getline( fIn, fileName);
cout << triviaName << " || " << fileName << endl;
}
fIn.close();
}
|
The problem is at the end ofg the file it prints
triviaName || FileName
||repeats last filename
any idea why it does this Im using a switch to call the function like this
1 2 3 4 5 6 7 8
|
switch(int)
case 'a':
Clist();
break;
case 'A':
Clist();
break;
|
I dont think the switch is the cause but i just cant think of why its doing that
Topic archived. No new replies allowed.