I have a string and i want to conver the part of it to an int.

I want to convert the part of the string input[1] to an int.

But my compiler cant use atoi, or stoi..

I saw a ifstringstream option i think can work, but i tried implementing it but it didnt work..
Here is what i have.

                int currentqueue = 0;

                std::stringstream converted(input[1]);

                currentqueue = converted;

What is wrong here?

Is input[1] just a single numeric digit? If it is, then you don't need any conversion program, just subtract '0' to convert it to integer.

For example:

char input[] = "X1";
int x = input[1] - '0';

Wow thats it! It works! Thank you so much, because they denied atoi and stoi at my school...

If your number has multiple digits a stringstream will work but you have to use the extraction operator(>>) to get automatic conversion:

int currentqueue = 0;
string input = "123";
std::stringstream converted;
converted << input;
converted >> currentqueue;

Beautiful this made things even better tinstaafl!

If you're happy with the answers you've gotten please remember to mark this solved so that others can benefit. Thanks.