Index: /trunk/BNC/RTCM3/RTCM3Decoder.cpp
===================================================================
--- /trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 507)
+++ /trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 508)
@@ -63,5 +63,5 @@
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
-RTCM3Decoder::RTCM3Decoder() : GPSDecoder() {
+RTCM3Decoder::RTCM3Decoder(const QByteArray& staID) : GPSDecoder() {
 
   const int LEAPSECONDS = 14; /* only needed for approx. time */
@@ -80,7 +80,7 @@
   _Parser2.GPSTOW  = tim%(7*24*60*60);
 
-  _Parser2.headerfile       = strdup("TEST_HEADERFILE");
-  _Parser2.glonassephemeris = strdup("TEST_GLONASSEPHEMERIS");
-  _Parser2.gpsephemeris     = strdup("TEST_GPSEPHEMERIS");
+  _Parser2.headerfile       = 0;
+  _Parser2.glonassephemeris = 0;
+  _Parser2.gpsephemeris     = (staID + ".EPH").data();
   _Parser2.rinex3           = 1;
 }
@@ -89,4 +89,10 @@
 ////////////////////////////////////////////////////////////////////////////
 RTCM3Decoder::~RTCM3Decoder() {
+  if (_Parser2.glonassfile) {
+    fclose(_Parser2.glonassfile);
+  }
+  if (_Parser2.gpsfile) {
+    fclose(_Parser2.gpsfile);
+  }
 }
 
@@ -94,9 +100,20 @@
 ////////////////////////////////////////////////////////////////////////////
 void RTCM3Decoder::Decode(char* buffer, int bufLen) {
+
+  // Direct file output
+  // ------------------
   for (int ii = 0; ii < bufLen; ii++) {
-
-    // Direct file output
-    // ------------------
     HandleByte(&_Parser2, (unsigned int) buffer[ii]);
+    if (_Parser2.glonassfile) {
+      fflush(_Parser2.glonassfile);
+    }
+    if (_Parser2.gpsfile) {
+      fflush(_Parser2.gpsfile);
+    }
+  }
+
+  // Fill the obs structure
+  // ----------------------
+  for (int ii = 0; ii < bufLen; ii++) {
 
     _Parser.Message[_Parser.MessageSize++] = buffer[ii];
Index: /trunk/BNC/RTCM3/RTCM3Decoder.h
===================================================================
--- /trunk/BNC/RTCM3/RTCM3Decoder.h	(revision 507)
+++ /trunk/BNC/RTCM3/RTCM3Decoder.h	(revision 508)
@@ -26,4 +26,5 @@
 #define RTCM3DECODER_H
 
+#include <QtCore>
 #include "../RTCM/GPSDecoder.h"
 
@@ -34,5 +35,5 @@
 class RTCM3Decoder : public GPSDecoder {
 public:
-  RTCM3Decoder();
+  RTCM3Decoder(const QByteArray& staID);
   ~RTCM3Decoder();
   void Decode(char* buffer = 0, int bufLen = 0);
Index: /trunk/BNC/bncgetthread.cpp
===================================================================
--- /trunk/BNC/bncgetthread.cpp	(revision 507)
+++ /trunk/BNC/bncgetthread.cpp	(revision 508)
@@ -333,5 +333,5 @@
     else if (_format.indexOf("RTCM_3") != -1) {
       emit(newMessage("Get Data: " + _staID + " in RTCM 3.0 format"));
-      _decoder = new RTCM3Decoder();
+      _decoder = new RTCM3Decoder(_staID);
     }
     else if (_format.indexOf("RTIGS") != -1) {
