Does anyone know how I could convert a string into int in C++?

I have the code ready set up but the result isn't what I expect.

example:

year = date_input.substr(second_slash, 4);

stringstream ss(year);
int in_year;
ss>> in_year;


let me know.. thanks!!