Changeset 109 in ntrip for trunk/BNC/bncapp.cpp
- Timestamp:
- Sep 7, 2006, 10:30:58 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncapp.cpp
r96 r109 16 16 * -----------------------------------------------------------------------*/ 17 17 18 #include <QFile>19 #include <QTextStream>20 18 #include <iostream> 21 19 … … 28 26 bncApp::bncApp(int argc, char* argv[], bool GUIenabled) : 29 27 QApplication(argc, argv, GUIenabled) { 28 29 _logFile = 0; 30 _logStream = 0; 31 for (int ii = 1; ii < argc; ii++) { 32 if (QString(argv[ii]) == "-o" && ii+1 < argc) { 33 _logFile = new QFile(argv[ii+1]); 34 _logFile->open(QIODevice::WriteOnly); 35 _logStream = new QTextStream(); 36 _logStream->setDevice(_logFile); 37 } 38 } 30 39 } 31 40 … … 33 42 //////////////////////////////////////////////////////////////////////////// 34 43 bncApp::~bncApp() { 44 delete _logStream; 45 delete _logFile; 35 46 } 36 47 … … 38 49 //////////////////////////////////////////////////////////////////////////// 39 50 void bncApp::slotMessage(const QByteArray msg) { 40 #ifndef WIN32 41 cerr << msg.data() << endl; 42 #else 43 static bool first = true; 44 static QFile logFile("BNC.LOG"); 45 static QTextStream logStream; 46 if (first) { 47 first = false; 48 logFile.open(QIODevice::WriteOnly); 49 logStream.setDevice(&logFile); 51 if (_logStream) { 52 *_logStream << msg.data() << endl; 53 _logStream->flush(); 50 54 } 51 logStream << msg.data() << endl;52 logStream.flush();53 #endif 55 else { 56 cerr << msg.data() << endl; 57 } 54 58 }
Note:
See TracChangeset
for help on using the changeset viewer.