How to convert string to float
-
wrote on 31 Jul 2021, 13:45 last edited by
Hi all!
It seems like a stupid question, but in Qt Creator neither std::stof nor std::atoi are working to convert a std::string to a floating point value.
The strangest thing is that it works fine running in Debug mode, but running the application normally, the decimal digits desappear from the variable.
I'm new to Qt, maybe there's something I'm missing.
Thank you in advance!
Re: How to convert string to double -
Hi all!
It seems like a stupid question, but in Qt Creator neither std::stof nor std::atoi are working to convert a std::string to a floating point value.
The strangest thing is that it works fine running in Debug mode, but running the application normally, the decimal digits desappear from the variable.
I'm new to Qt, maybe there's something I'm missing.
Thank you in advance!
Re: How to convert string to doublewrote on 31 Jul 2021, 14:11 last edited by@MatteoMB
Hello and welcome.Qt Creator is not a compiler. And Qt is not a language. So there is no concept of them "making/preventing something work".
What you ask about sounds like you are just using C++
std
library and have incorrect code. Nothing to do with Qt. You could paste your code here (if it's short!), someone may answer, or take it to a more appropriate C++ forum. -
wrote on 1 Aug 2021, 02:43 last edited by
std::istringstream
there are tons of examples online.
1/3