Changeset 109 in ntrip
- Timestamp:
- Sep 7, 2006, 10:30:58 AM (18 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 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 } -
trunk/BNC/bncapp.h
r82 r109 4 4 5 5 #include <QApplication> 6 #include <QFile> 7 #include <QTextStream> 6 8 7 9 class bncApp : public QApplication { 8 10 Q_OBJECT 9 10 11 public: 11 12 bncApp(int argc, char* argv[], bool GUIenabled); 12 13 virtual ~bncApp(); 13 14 14 public slots: 15 15 void slotMessage(const QByteArray msg); 16 17 private slots: 16 private: 17 QFile* _logFile; 18 QTextStream* _logStream; 18 19 }; 19 20 #endif
Note:
See TracChangeset
for help on using the changeset viewer.