Reputation: 6323
I try the following where I added date and time but now nothing is written to the file. ??
QString hoho = QDate::currentDate().toString("yyyy.MM.dd") + QTime::currentTime().toString(".hh.mm.ss.zzz");
fprintf(fp, "%s timer timer3 timer5 timer6 timer7\n", hoho.toStdString().c_str());
Upvotes: 0
Views: 105
Reputation: 229108
A FILE* is normally fully buffered, meaning nothing is written to the file until the internal buffer of the FILE* is full, or until you flush the FILE* (flushing is also done when closing the file).
So flush it by adding this after the fprintf() call:
fflush(fp);
Upvotes: 2