My overall goal in this was to convert binary strings to integers, but now i am interested in also learning stringstream.
After looking around i found the method stringstream to be best?
The only problem i found when i was trying to use it to convert binary strings to ints was it stripped the initial 0, if it had one. Now this makes sense on average use, but what if you were using it to convert binary strings to ints?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
string stringer = "01100110";
ss >> i;
cout << i + 1<< endl;
int inter = 123;
num_str << inter;
cout << num_str.str() + "test" <<endl;
to be honest i was looking for a standard way for (int into str and str to int. ) I was looking at not to confuse myself as i just returned to c++ from python. I'm surprised at how hard it is to do basic things that in python i didnt even think of.
so in essence, i was looking for the same method to convert to and from, whereas atoi or itoa, ummm one of them is not in the standard library of C++.