So i have a string containing numbers, and i want to take one of those numbers and convert it to an int like that :
string s = "13245";
int a = stoi(s.at(3));
I have tried stoi :
int a = stoi(s.at(3));
I have tried atoi :
int a = atoi(s.at(3));
But none of those ways works, the only way i've found is the C way :
int a = s.at(3)-'0';
Do you know why stoi / atoi don't work ? Do you have any other way to convert a character taken from a string to an int ?