QApplication value changing std :: to_string value
Qt seems to change the "interpretation" of the returned string std :: to_string (double). Example:
#include <iostream>
#include <QApplication>
#define VERSION 1.0
#define VSIZE 3
int main(int argc, char** argv) {
std::string version = std::to_string(VERSION).substr(0, VSIZE);
std::cout << version << std::endl; // everything fine
QApplication app(argc, argv);
std::cout << std::to_string(VERSION).substr(0, VSIZE); // no good
return 0;
}
Output:
1.0
1,0
I think this is Qt because it is the most subtle example of where this happens and removing the QApplication declaration makes it work again. How can I fix this?
+3
source to share
No one has answered this question yet
See similar questions:
or similar: