This is what I did to get 888888.888888:
for(int i; i < m_iBuild; i++){
out << QString::number(dLog[i] - dLog[0], 'f', 6) << "\t" << msgList.at(cLog[i]) << "\n";
}
Question
I want to place a double into a QString with a format that yields 6 decimal digits.
ie. %1.6f
This crashes with memory dump:
char *x = (char*)malloc(20 * sizeof(char));
for(int i; i < m_iBuild; i++){
std::fill_n(x, 20, '\0');
sprintf(x, "%1.12f", dLog[i]);
out << x << "\t" << msgList.at(cLog[i]) << "\n";
}
If I just placed dLog[i] into the stream I get scientific notation of 5 digits.
Solution
This is what I did to get 888888.888888:
for(int i; i < m_iBuild; i++){
out << QString::number(dLog[i] - dLog[0], 'f', 6) << "\t" << msgList.at(cLog[i]) << "\n";
}