I am having trouble reading in values from a csv file. I take the values in as strings and convert to ints. The issue I am having is that I keep falling into an infinte loop, printing out 0's. I have been trying to fix this for a while and am totally stumped. Here is the function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
void FileWork::processfile(){
string val;
int num;
ifstream myfile;
myfile.open("u1.txt");
if(myfile.is_open()){
while(myfile.end){
getline(myfile,val,',');
num = atoi(val.c_str());
printf("num is %d \n",num);
}
}
myfile.close();
}