Details
-
Bug
-
Resolution: Cannot Reproduce
-
P2: Important
-
None
-
5.15.2
-
None
Description
Here is a reproducible example:
#include <QCoreApplication> #include <QDateTime> #include <QFile> #include <QTextStream> int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QFile file(qApp->applicationDirPath() + "/test.txt"); if (file.open(QIODevice::WriteOnly)) { while (true) { QTextStream out(&file); out << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss ") << Qt::endl; } } }
Then, changing the loop to this will work fine:
QByteArray result;
QTextStream(&result) << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss ") << Qt::endl;
file.write(result);