I'm trying to read strings from a file and initializing objects (from type "Movimentacao") with this strings and putting these objects into a vector. To do that, I have to transform some strings into ints but when I try to execute the program, it shows this error:
terminate called after throwing an instance of 'std::invalid_argument'
what(): stoi
The code compiles normally and, with some couts to debbug, I found that the loop executes one time, but in the second time, it stops on the line with the "stoi" command.
while(!mov.eof()){
getline(mov, dia, ',');
getline(mov, mes, ',');
getline(mov, ano, ',');
getline(mov, desc, ',');
getline(mov, sigla, ',');
getline(mov, val, ',');
sig = sigla[0];
Movimentacao M(stoi(dia), stoi(mes), stoi(ano), desc, sig, stod(val));
movi.push_back(M);
}