Ho uno std :: string: 01001
, voglio ottenere ogni numero:parte std :: stringa in numero intero
std::string foo = "01001";
for (int i=0; i < foo.size(); ++i)
{
int res = atoi(foo[i]); // fail
int res = atoi(&foo[i]); // ok, but res = 0 in any case
}
come fare?
Come funziona? – Ockonal