Index: /trunk/BNC/src/bncoutf.cpp
===================================================================
--- /trunk/BNC/src/bncoutf.cpp	(revision 6330)
+++ /trunk/BNC/src/bncoutf.cpp	(revision 6331)
@@ -35,12 +35,14 @@
   _numSec        = 0;
 
-  QFileInfo fileInfo(sklFileName);
-  _path        = fileInfo.absolutePath() + QDir::separator();
-  _sklBaseName = fileInfo.baseName();
-  _extension   = fileInfo.completeSuffix(); 
-
-  expandEnvVar(_path);
-  if (!_extension.isEmpty()) {
-    _extension = "." + _extension;
+  if (! sklFileName.isEmpty()) {
+    QFileInfo fileInfo(sklFileName);
+    _path        = fileInfo.absolutePath() + QDir::separator();
+    _sklBaseName = fileInfo.baseName();
+    _extension   = fileInfo.completeSuffix(); 
+    
+    expandEnvVar(_path);
+    if (!_extension.isEmpty()) {
+      _extension = "." + _extension;
+    }
   }
 
Index: /trunk/BNC/src/bncsp3.cpp
===================================================================
--- /trunk/BNC/src/bncsp3.cpp	(revision 6330)
+++ /trunk/BNC/src/bncsp3.cpp	(revision 6331)
@@ -17,4 +17,5 @@
 
 #include <iomanip>
+#include <sstream>
 #include <math.h>
 
@@ -26,6 +27,29 @@
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
+bncSP3::bncSP3(const QString& fileName) : bncoutf(QString(), QString(), 0) {
+  _inpOut    = input;
+  _currEpoch = 0;
+  _prevEpoch = 0;
+
+  _stream.open(fileName.toAscii().data());
+  if (!_stream.good()) {
+    throw "t_sp3File: cannot open file " + fileName;
+  }  
+
+  while (_stream.good()) {
+    getline(_stream, _lastLine);
+    if (_lastLine[0] == '*') {
+      break;
+    }
+  }
+}
+
+// Constructor
+////////////////////////////////////////////////////////////////////////////
 bncSP3::bncSP3(const QString& sklFileName, const QString& intr, int sampl) 
   : bncoutf(sklFileName, intr, sampl) {
+  _inpOut    = output;
+  _currEpoch = 0;
+  _prevEpoch = 0;
 }
 
@@ -33,4 +57,6 @@
 ////////////////////////////////////////////////////////////////////////////
 bncSP3::~bncSP3() {
+  delete _currEpoch;
+  delete _prevEpoch;
 }
 
@@ -133,2 +159,40 @@
 }
 
+// Read Next Epoch
+////////////////////////////////////////////////////////////////////////////
+const bncSP3::t_sp3Epoch* bncSP3::nextEpoch() {
+
+  delete _prevEpoch; _prevEpoch = _currEpoch; _currEpoch = 0;
+
+  while (true) {
+
+    if (!_currEpoch) {
+      _currEpoch = new t_sp3Epoch();
+      istringstream in(_lastLine.substr(1).c_str());
+      int    YY, MM, DD, hh, mm;
+      double ss;
+      in >> YY >> MM >> DD >> hh >> mm >> ss;
+      _currEpoch->_tt.set(YY, MM, DD, hh, mm, ss);
+    }
+
+    getline(_stream, _lastLine);
+    if (_stream.eof() || _lastLine.find("EOF") == 0) {
+      throw "t_sp3File: end of file";
+      break;
+    }
+    if (_lastLine[0] == '*') {
+      break;
+    }
+
+    t_sp3Sat* sp3Sat = new t_sp3Sat();
+    istringstream in(_lastLine.substr(1).c_str());
+    in >> sp3Sat->_prn >> sp3Sat->_xyz(1) >> sp3Sat->_xyz(2) >> sp3Sat->_xyz(3) >> sp3Sat->_clk; 
+
+    sp3Sat->_xyz *= 1.e3;
+    sp3Sat->_clk *= t_CST::c * 1.e-6;
+
+    _currEpoch->_sp3Sat.push_back(sp3Sat);
+  }
+
+  return _currEpoch;
+}
Index: /trunk/BNC/src/bncsp3.h
===================================================================
--- /trunk/BNC/src/bncsp3.h	(revision 6330)
+++ /trunk/BNC/src/bncsp3.h	(revision 6331)
@@ -8,8 +8,36 @@
 #include "bncoutf.h"
 #include "bnctime.h"
+#include "t_prn.h"
 
 class bncSP3 : public bncoutf {
  public:
-  bncSP3(const QString& sklFileName, const QString& intr, int sampl);
+
+  class t_sp3Sat {
+   public:
+    t_sp3Sat() {
+      _xyz.ReSize(3); 
+      _xyz = 0.0;
+      _clk = 0.0;
+    }
+    ~t_sp3Sat() {}
+    t_prn        _prn;
+    ColumnVector _xyz;
+    double       _clk;
+  };
+
+  class t_sp3Epoch {
+   public:
+    t_sp3Epoch() {}
+    ~t_sp3Epoch() {
+      for (int ii = 0; ii < _sp3Sat.size(); ii++) {
+        delete _sp3Sat[ii];
+      }
+    }
+    bncTime            _tt;
+    QVector<t_sp3Sat*> _sp3Sat;
+  };
+
+  bncSP3(const QString& fileName); // input
+  bncSP3(const QString& sklFileName, const QString& intr, int sampl); // output
   virtual ~bncSP3();
   t_irc write(int GPSweek, double GPSweeks, const QString& prn, 
@@ -17,7 +45,18 @@
 
  private:
+  enum e_inpOut {input, output};
+
   virtual void writeHeader(const QDateTime& datTim);
   virtual void closeFile();
-  bncTime _lastEpoTime;
+  const t_sp3Epoch* nextEpoch();
+  const t_sp3Epoch* currEpoch() const {return _currEpoch;}
+  const t_sp3Epoch* prevEpoch() const {return _prevEpoch;}
+
+  e_inpOut      _inpOut;
+  bncTime       _lastEpoTime;
+  std::ifstream _stream;
+  std::string   _lastLine;
+  t_sp3Epoch*   _currEpoch;
+  t_sp3Epoch*   _prevEpoch;
 };
 
