Index: /trunk/BNS/bnseph.cpp
===================================================================
--- /trunk/BNS/bnseph.cpp	(revision 1088)
+++ /trunk/BNS/bnseph.cpp	(revision 1089)
@@ -29,4 +29,31 @@
 
   _socket = 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;
+  }
+
+  // Echo ephemeris into a file
+  // ---------------------------
+  QString echoFileName = settings.value("ephEcho").toString();
+  if (echoFileName.isEmpty()) {
+    _echoFile   = 0;
+    _echoStream = 0;
+  }
+  else {
+    _echoFile = new QFile(echoFileName);
+    if (_echoFile->open(oMode)) {
+      _echoStream = new QTextStream(_echoFile);
+    }
+    else {
+      _echoStream = 0;
+    }
+  }
 }
 
@@ -35,4 +62,6 @@
 t_bnseph::~t_bnseph() {
   delete _socket;
+  delete _echoStream;
+  delete _echoFile;
 }
 
@@ -87,4 +116,10 @@
   t_eph* eph = 0;
   QByteArray line = waitForLine(_socket);
+
+  if (_echoStream) {
+    *_echoStream << line;
+    _echoStream->flush();
+  }
+
   nBytes += line.length();
 
@@ -109,4 +144,10 @@
   for (int ii = 2; ii <= numlines; ii++) {
     QByteArray line = waitForLine(_socket);
+
+    if (_echoStream) {
+      *_echoStream << line;
+      _echoStream->flush();
+    }
+
     nBytes += line.length();
     lines << line;
Index: /trunk/BNS/bnseph.h
===================================================================
--- /trunk/BNS/bnseph.h	(revision 1088)
+++ /trunk/BNS/bnseph.h	(revision 1089)
@@ -116,4 +116,6 @@
   void readEph();
   QTcpSocket* _socket;
+  QFile*                    _echoFile;
+  QTextStream*              _echoStream;
 };
 #endif
Index: /trunk/BNS/bnswindow.cpp
===================================================================
--- /trunk/BNS/bnswindow.cpp	(revision 1088)
+++ /trunk/BNS/bnswindow.cpp	(revision 1089)
@@ -160,4 +160,6 @@
   _ephPortLineEdit->setWhatsThis(tr("BNS reads Broadcast Ephemeris in RINEX Version 3 Navigation file format from an IP address. Specify the IP port e.g. of a BNC installation providing this information."));
   _ephPortLineEdit->setMaximumWidth(9*ww);
+  _ephEchoLineEdit  = new QLineEdit(settings.value("ephEcho").toString());
+  _ephEchoLineEdit->setWhatsThis(tr("Specify the full path to a file where incoming Broadcast Ephemeris are saved. Beware that the size of this file can rapidly increase. Default is an empty option field meaning that incoming Broadcast Ephemeris are not saved."));
 
   _clkPortLineEdit  = new QLineEdit(settings.value("clkPort").toString());
@@ -294,6 +296,8 @@
   layout_eph->addWidget(new QLabel("Port"),                   1, 0);
   layout_eph->addWidget(_ephPortLineEdit,                     1, 1);
-  layout_eph->addWidget(new QLabel("Read broadcast ephemeris."), 2, 0, 1, 2, Qt::AlignLeft);
-  layout_eph->addWidget(new QLabel(""),                       3, 0);
+  layout_eph->addWidget(new QLabel("Save (full path)"),       2, 0);
+  layout_eph->addWidget(_ephEchoLineEdit,                     2, 1);
+  layout_eph->addWidget(new QLabel("Read broadcast ephemeris."), 3, 0, 1, 2, Qt::AlignLeft);
+  layout_eph->addWidget(new QLabel(""),                       4, 0);
 
   tab_eph->setLayout(layout_eph);
@@ -535,4 +539,5 @@
   settings.setValue("ephHost",    _ephHostLineEdit->text());
   settings.setValue("ephPort",    _ephPortLineEdit->text());
+  settings.setValue("ephEcho",    _ephEchoLineEdit->text());
   settings.setValue("clkPort",    _clkPortLineEdit->text());
   settings.setValue("outHost",    _outHostLineEdit->text());
Index: /trunk/BNS/bnswindow.h
===================================================================
--- /trunk/BNS/bnswindow.h	(revision 1088)
+++ /trunk/BNS/bnswindow.h	(revision 1089)
@@ -75,4 +75,5 @@
   QLineEdit* _ephHostLineEdit;
   QLineEdit* _ephPortLineEdit;
+  QLineEdit* _ephEchoLineEdit;
   QLineEdit* _clkPortLineEdit;
   QLineEdit* _logFileLineEdit;
