I don't know anything about vectors and other stuff. I'm pretty new to this stuff, so I'm looking for something as simple as parseInt(String str);
Is there a very very simple equivalent of java's parseInt() in c++?
The C way is to use atoi(). Since it only returns a value, its hard to tell if it just failed. You can also use sscanf() which kind of works the way sprintf() does but in reverse.
The C++ way if you have a std::string is to use istringstream from the %26lt;sstream%26gt; header. Then you can use the %26gt;%26gt; operator.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment