I have a logging class that I wish to use to append messages to a file. Naturally, I wrote a write(QString msg) for my class that I wish clients to be able to call in order to append a message to the current log file. But I can't seem to successfully write to the file... it seems to have a problem with how I am using my member variables. I have successfully written to a file like this, but only when I open it and write to it in one block of code (like how you see here: http://www.digitalfanatics.org/proje...chapter08.html). Here's my code that isn't working (_fileTextStream is a member variable of type QTextStream):
Qt Code:
Logger::Logger() { { tr("Error opening log file for writing."), tr("Couldn't open file: %1").arg( file.errorString() ) ); } } { _fileTextStream << message << endl; }To copy to clipboard, switch view to plain text mode
Bookmarks