Index: trunk/BNS/bns.cpp
===================================================================
--- trunk/BNS/bns.cpp	(revision 1064)
+++ trunk/BNS/bns.cpp	(revision 1065)
@@ -79,4 +79,6 @@
           this, SLOT(slotMessage(const QByteArray)));
 
+  // Log File
+  // --------
   QIODevice::OpenMode oMode;
   if (Qt::CheckState(settings.value("fileAppend").toInt()) == Qt::Checked) {
@@ -87,18 +89,4 @@
   }
 
-  QString outFileName = settings.value("outFile").toString();
-  if (outFileName.isEmpty()) {
-    _outFile   = 0;
-    _outStream = 0;
-  }
-  else {
-    _outFile = new QFile(outFileName);
-    if (_outFile->open(oMode)) {
-      _outStream = new QTextStream(_outFile);
-    }
-  }
-
-  // Log File
-  // --------
   QString logFileName = settings.value("logFile").toString();
   if (logFileName.isEmpty()) {
@@ -159,7 +147,5 @@
   delete _clkSocket;
   delete _caster;
-  delete _outStream;
   delete _logStream;
-  delete _outFile;
   delete _logFile;
   QMapIterator<QString, t_ephPair*> it(_ephList);
@@ -357,10 +343,13 @@
           }
           if (sd) {
-            processSatellite(oldEph, ep, GPSweek, GPSweeks, prn, xx, sd);
+            QString outLine;
+            processSatellite(oldEph, ep, GPSweek, GPSweeks, prn, xx, 
+                             sd, outLine);
+            _caster->printAscii(line);
           }
         }
       }
     
-      if ( (_caster->used() || _outFile) && 
+      if ( _caster->used() && 
            (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
         char obuffer[CLOCKORBIT_BUFFERSIZE];
@@ -379,5 +368,6 @@
 void t_bns::processSatellite(int oldEph, t_eph* ep, int GPSweek, double GPSweeks, 
                              const QString& prn, const ColumnVector& xx, 
-                             struct ClockOrbit::SatData* sd) {
+                             struct ClockOrbit::SatData* sd,
+                             QString& outLine) {
 
   ColumnVector xB(4);
@@ -407,13 +397,9 @@
   }
 
-  if (_outStream) {
-    QString line;
-    char oldCh = (oldEph ? '!' : ' ');
-    line.sprintf("%c %d %.1f %s  %3d  %10.3f  %8.3f %8.3f %8.3f\n", 
-                 oldCh, GPSweek, GPSweeks, ep->prn().toAscii().data(),
-                 ep->IOD(), dClk, rsw(1), rsw(2), rsw(3));
-    *_outStream << line;
-    _outStream->flush();
-  }
+  char oldCh = (oldEph ? '!' : ' ');
+  outLine.sprintf("%c %d %.1f %s  %3d  %10.3f  %8.3f %8.3f %8.3f\n", 
+                  oldCh, GPSweek, GPSweeks, ep->prn().toAscii().data(),
+                  ep->IOD(), dClk, rsw(1), rsw(2), rsw(3));
+
   if (!oldEph) {
     if (_rnx) {
Index: trunk/BNS/bns.h
===================================================================
--- trunk/BNS/bns.h	(revision 1064)
+++ trunk/BNS/bns.h	(revision 1065)
@@ -61,5 +61,5 @@
   void processSatellite(int oldEph, t_eph* ep, int GPSweek, double GPSweeks, 
                         const QString& prn, const ColumnVector& xx, 
-                        struct ClockOrbit::SatData* sd);
+                        struct ClockOrbit::SatData* sd, QString& outLine);
   void crdTrafo(int GPSWeek, ColumnVector& xyz);
 
@@ -67,7 +67,5 @@
   QTcpSocket*               _clkSocket;
   t_bnscaster*              _caster;
-  QFile*                    _outFile;
   QFile*                    _logFile;
-  QTextStream*              _outStream;
   QTextStream*              _logStream;
   t_bnseph*                 _bnseph;
Index: trunk/BNS/bnscaster.cpp
===================================================================
--- trunk/BNS/bnscaster.cpp	(revision 1064)
+++ trunk/BNS/bnscaster.cpp	(revision 1065)
@@ -26,4 +26,26 @@
   _outSocket          = 0;
   _outSocketOpenTrial = 0;
+
+  QSettings settings;
+
+  QIODevice::OpenMode oMode;
+  if (Qt::CheckState(settings.value("fileAppend").toInt()) == Qt::Checked) {
+    oMode = QIODevice::WriteOnly | QIODevice::Unbuffered | QIODevice::Append;
+  }
+  else {
+    oMode = QIODevice::WriteOnly | QIODevice::Unbuffered;
+  }
+
+  QString outFileName = settings.value("outFile").toString();
+  if (outFileName.isEmpty()) {
+    _outFile   = 0;
+    _outStream = 0;
+  }
+  else {
+    _outFile = new QFile(outFileName);
+    if (_outFile->open(oMode)) {
+      _outStream = new QTextStream(_outFile);
+    }
+  }
 }
 
@@ -32,4 +54,6 @@
 t_bnscaster::~t_bnscaster() {
   delete _outSocket;
+  delete _outStream;
+  delete _outFile;
 }
 
@@ -101,2 +125,11 @@
   }
 }
+
+// Print Ascii Output
+////////////////////////////////////////////////////////////////////////////
+void t_bnscaster::printAscii(const QString& line) {
+  if (_outStream) {
+    *_outStream << line;
+     _outStream->flush();
+  }
+}
Index: trunk/BNS/bnscaster.h
===================================================================
--- trunk/BNS/bnscaster.h	(revision 1064)
+++ trunk/BNS/bnscaster.h	(revision 1065)
@@ -11,5 +11,6 @@
   void open();
   void write(char* buffer, unsigned len);
-  bool used() {return _outSocket;}
+  void printAscii(const QString& line);
+  bool used() {return _outSocket || _outFile;}
 
  signals:
@@ -18,8 +19,10 @@
 
  private:
-  QString     _mountpoint;
-  QTcpSocket* _outSocket;
-  int         _outSocketOpenTrial;
-  QDateTime   _outSocketOpenTime;
+  QString      _mountpoint;
+  QTcpSocket*  _outSocket;
+  int          _outSocketOpenTrial;
+  QDateTime    _outSocketOpenTime;
+  QFile*       _outFile;
+  QTextStream* _outStream;
 };
 
