grippins — 5/12/2025, 9:39:45 PM

Considering using .c_str() and feeding it into atoi()

↩ repost
grippins — 5/12/2025, 2:05:41 PM

Tips on taking a C++ string class object that only contains a number (e.g. "-200") and converting it into an int or double?

♥ 3 ↩ 1 💬 4 comments
♥ 2 ↩ 0 💬 3 comments

comments

grahamsh:

https://en.cppreference.com/w/cpp/string/basic_string/stol

https://en.cppreference.com/w/cpp/string/basic_string/stod

5/12/2025, 10:09:36 PM
grahamsh:

sorry that second link should be

https://en.cppreference.com/w/cpp/string/basic_string/stof

5/12/2025, 10:10:14 PM
grippins:

Thank you.

5/13/2025, 4:28:52 AM