I have to make a program that reads information for a student from a file, and I made a couple of vectors to keep all that information. But then I need to sum up the absences of all the students, so I need to convert them to integer, however when I try to the program runs, but crashes immediately when it reaches the atoi part.
while(!read.eof()) {
    if(i==4){
        i=0;
    }
    read>>b;
    if(i==0){ names.push_back(b); }
    if(i==1){ last_name.push_back(b); }
    if(i==2){ absences.push_back(b); }
    if(i==3){ unatoned.push_back(b); }
    i++;
}
int a = atoi(absences[0].c_str());
 
     
     
    