C++ String to Integer

Thread Starter

TheFox

Joined Apr 29, 2009
66
What I am doing should seem very possible, however, it is not working for me. I am trying to get an input and get the number of characters in the string, and put that as an integer of some kind. every time I try a various string of characters, it gives the same negative number. It is also always the same number, -858993460.

Rich (BB code):
int encryption(string encry)
{
    int encry_size;
    string encry2;
    encry2=encry;
    stringstream convert(encry.size());
    convert >> encry_size;
    cout<<encry_size<<"\n";
    return encry_size;
}
If you are to print the value of "encry2" it will give you a spade, like from a deck of cards.
 
Top