Dear Expert,
How to redirect all qDebug statements (output) to a file?, and also if (file) it reaches the fixed size (for example: 1MB), then it should open an another and write the contents into that file, instead of writing on to a stdout.
I would really appreciate the quick response.. thanks in advance. 
void mymsghand(const char *msg) {
QFile outFile
("outfile.log");
ts << txt << endl;
}
int main(int argc, char *argv) {
qInstallMsgHandler(mymsghand);
...
return app.exec();
}
void mymsghand(const char *msg) {
QString txt;
txt = QString("%1").arg(msg);
QFile outFile("outfile.log");
outFile.open(QIODevice:WriteOnly | QIODevice:Append);
QTextStream ts(&outFile);
ts << txt << endl;
}
int main(int argc, char *argv) {
QApplication app(argc, argv);
qInstallMsgHandler(mymsghand);
...
return app.exec();
}
To copy to clipboard, switch view to plain text mode
But here i really dont know how to check the file max size, as when it reaches the max size it should create another file and start write into the new file.
Regards,
Maiya
Bookmarks