Index: trunk/tools/FlairGCS/src/ConnectionLayout.cpp
===================================================================
--- trunk/tools/FlairGCS/src/ConnectionLayout.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/ConnectionLayout.cpp	(revision 244)
@@ -23,7 +23,7 @@
 
 void ConnectionLayout::receive(char *buf, int size) {
-  // printf("trame %x\n",buf[0]);
-  // for(int i=0; i<size;i++) printf("%x ",buf[i]);
-  // printf("\n");
+  // fprintf(stderr,"trame %x\n",buf[0]);
+  // for(int i=0; i<size;i++) fprintf(stderr,"%x ",buf[i]);
+  // fprintf(stderr,"\n");
   switch ((unsigned char)buf[0]) {
   case XML_HEADER: {
@@ -33,7 +33,7 @@
     xml.resize(size);
 
-    // printf("recu %i\n%s\n",size,xml.toLocal8Bit().constData());
+    // fprintf(stderr,"recu %i\n%s\n",size,xml.toLocal8Bit().constData());
     if (!doc.setContent(xml)) {
-      printf("prob setContent fichier\n");
+      fprintf(stderr,"prob setContent fichier\n");
     }
 
@@ -42,6 +42,6 @@
   }
   case DATAS_BIG_ENDIAN: {
-    // for(int i=0;i<size;i++) printf("%x ",buf[i]);
-    // printf("\n");
+    // for(int i=0;i<size;i++) fprintf(stderr,"%x ",buf[i]);
+    // fprintf(stderr,"\n");
     uint16_t period;
     memcpy(&period, &buf[1], sizeof(uint16_t));
@@ -51,19 +51,19 @@
   }
   case DATAS_LITTLE_ENDIAN: {
-    // for(int i=0;i<size;i++) printf("%x ",buf[i]);
-    // printf("\n");
+    // for(int i=0;i<size;i++) fprintf(stderr,"%x ",buf[i]);
+    // fprintf(stderr,"\n");
     uint16_t period;
     memcpy(&period, &buf[1], sizeof(uint16_t));
-    // printf("recu %i period %i\n",size,period);
+    // fprintf(stderr,"recu %i period %i\n",size,period);
     drawDatas(&buf[3], size - 3, period);
     break;
   }
   default:
-    printf("trame non supportée %x\n", buf[0]);
+    fprintf(stderr,"trame non supportée %x\n", buf[0]);
   }
 }
 
 void ConnectionLayout::XmlToSend(QDomDocument doc) {
-  // printf("xml to send\n%s\n",doc.toString().toLocal8Bit().constData());
+  // fprintf(stderr,"xml to send\n%s\n",doc.toString().toLocal8Bit().constData());
   
   // xml to send a mettre dans le manager
@@ -83,5 +83,5 @@
     XmlWidget::LoadXml(tmp);
   } else {
-    printf("%s not found in xml file \n", name.toLocal8Bit().constData());
+    fprintf(stderr,"%s not found in xml file \n", name.toLocal8Bit().constData());
   }
 }
@@ -111,5 +111,5 @@
 
   if (!doc.setContent(xml)) {
-    printf("prob setContent fichier\n");
+    fprintf(stderr,"prob setContent fichier\n");
   }
   
Index: trunk/tools/FlairGCS/src/DataPlot1D.cpp
===================================================================
--- trunk/tools/FlairGCS/src/DataPlot1D.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/DataPlot1D.cpp	(revision 244)
@@ -40,5 +40,5 @@
       receivesize += sizeof(int16_t);
     } else {
-      printf("MyDataPlot1D::addCurve unknown type %s\n",
+      fprintf(stderr,"MyDataPlot1D::addCurve unknown type %s\n",
              type.toLocal8Bit().constData());
     }
@@ -97,5 +97,5 @@
       datas[i] = data;
     } else {
-      printf("DataPlot1D::BufEvent unknown type %s\n",
+      fprintf(stderr,"DataPlot1D::BufEvent unknown type %s\n",
              datas_type.at(i).toLocal8Bit().constData());
     }
Index: trunk/tools/FlairGCS/src/DataPlot2D.cpp
===================================================================
--- trunk/tools/FlairGCS/src/DataPlot2D.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/DataPlot2D.cpp	(revision 244)
@@ -212,5 +212,5 @@
     receivesize += sizeof(int16_t);
   } else {
-    printf("DataPlot2D::addCurve unknown type %s\n",
+    fprintf(stderr,"DataPlot2D::addCurve unknown type %s\n",
            type.toLocal8Bit().constData());
   }
@@ -287,5 +287,5 @@
       plot_data(data1, data2, i);
     } else {
-      printf("DataPlot2D::DrawDatas type non connu\n");
+      fprintf(stderr,"DataPlot2D::DrawDatas type non connu\n");
     }
   }
Index: trunk/tools/FlairGCS/src/Layout.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Layout.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/Layout.cpp	(revision 244)
@@ -40,7 +40,7 @@
 void Layout::Constructor(QString name) {
   visible_widget = qgridlayout->parentWidget();
-  // if(visible_widget==NULL) printf("null\n");
+  // if(visible_widget==NULL) fprintf(stderr,"null\n");
   qgridlayout->setObjectName(name);
-  // printf("layout\n%s\n",XmlDoc().toString().toLocal8Bit().constData());
+  // fprintf(stderr,"layout\n%s\n",XmlDoc().toString().toLocal8Bit().constData());
   SetIsContainer(true);
   SetIsExpandable(true);
@@ -97,6 +97,7 @@
   // if an item already exists at this position, put it on a new row
   if (qgridlayout->itemAtPosition(row, col) != NULL) {
-    printf("existe %s\n", name.toLocal8Bit().constData());
+    fprintf(stderr,"widget %s: (%i,%i) already exists\n", name.toLocal8Bit().constData(),row, col);
     row = qgridlayout->rowCount();
+    fprintf(stderr,"using (%i,%i) for %s\n", row, col,name.toLocal8Bit().constData());
   }
 
Index: trunk/tools/FlairGCS/src/Manager.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Manager.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/Manager.cpp	(revision 244)
@@ -37,5 +37,5 @@
   qRegisterMetaType<QModelIndex>("QModelIndex"); // pour le file ui??
   this->name = name;
-//fprintf(stderr,"Manager %x\n",thread());
+//ffprintf(stderr,stderr,"Manager %x\n",thread());
   setWindowTitle(name);
 
@@ -88,9 +88,9 @@
 
   if (UDT::ERROR == UDT::bind(serv, (sockaddr *)&my_addr, sizeof(my_addr))) {
-    printf("bind error, %s\n", UDT::getlasterror().getErrorMessage());
+    fprintf(stderr,"bind error, %s\n", UDT::getlasterror().getErrorMessage());
   }
 
   if (UDT::ERROR == UDT::listen(serv, 1)) {
-    printf("listen error, %s\n", UDT::getlasterror().getErrorMessage());
+    fprintf(stderr,"listen error, %s\n", UDT::getlasterror().getErrorMessage());
   }
 
@@ -101,5 +101,4 @@
 
 Manager::~Manager() {
-  printf("%i\n",udtSockets.count());
   for (int i = 0; i < udtSockets.count(); i++) {
     udtSockets.at(i)->kill();
@@ -109,5 +108,4 @@
   // delete main_layout;
   UDT::cleanup();
-  printf("ok\n");
 }
 
@@ -120,9 +118,9 @@
   if (UDT::INVALID_SOCK ==(socket = UDT::accept(serv, (sockaddr *)&their_addr, &namelen))) {
     if (UDT::getlasterror().getErrorCode() != 6002)
-      printf("accept error: %s, code %i\n", UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode());
+      fprintf(stderr,"accept error: %s, code %i\n", UDT::getlasterror().getErrorMessage(),UDT::getlasterror().getErrorCode());
     return;
   } else {
     QString name=QString("%1:%2").arg(inet_ntoa(their_addr.sin_addr)).arg(their_addr.sin_port);
-    printf("connected to %s\n",name.toLocal8Bit().constData());
+    fprintf(stderr,"connected to %s\n",name.toLocal8Bit().constData());
     
     QThread *thread = new QThread(this);
@@ -148,4 +146,5 @@
   connect(udtSocket, SIGNAL(dataReady(char *, int)), newLayout,SLOT(receive(char *, int)),Qt::BlockingQueuedConnection);
   connect(newLayout, SIGNAL(destroyed(QObject *)), this, SLOT(layoutDestroyed(QObject *)));
+  connect(udtSocket, SIGNAL(destroyed(QObject *)), this, SLOT(udtSocketDestroyed(QObject *)));
   connect(udtSocket, SIGNAL(destroyed()), newLayout, SLOT(deleteLater()));
   
@@ -171,7 +170,15 @@
 }
 
+void Manager::udtSocketDestroyed(QObject *obj) {
+  udtSockets.removeOne((UdtSocket *)obj);
+}
+
 void Manager::layoutDestroyed(QObject *obj) {
   int index = connectionsLayout.indexOf((ConnectionLayout *)obj);
 
+  delete connectionsWidget.at(index);
+  connectionsWidget.removeAt(index);
+  connectionsLayout.removeOne((ConnectionLayout *)obj);
+  
   //tab: avoid having only 1 tab (0, 2 or more)
   if (tabBar->count() > 1) {
@@ -179,8 +186,4 @@
   }
 
-  delete connectionsWidget.at(index);
-  connectionsWidget.removeAt(index);
-  connectionsLayout.removeOne((ConnectionLayout *)obj);
-
   if (connectionsLayout.count() == 1) {
     hiddenTabName = tabBar->tabText(0);
@@ -191,4 +194,6 @@
     status->showMessage("");
   }
+  
+  
 }
 
@@ -222,6 +227,8 @@
 
 void Manager::tabBarCurrentChanged(int index) {
+  
   if (index >= 0) {
-    connectionsWidget.at(currentTab)->hide();
+    //if we are coming from layout destroyed
+    if(currentTab<connectionsLayout.count()) connectionsWidget.at(currentTab)->hide();
     connectionsWidget.at(index)->show();
     currentTab = index;
@@ -230,5 +237,4 @@
     connectionsWidget.at(0)->show();
   }
-  
   if (tabBar->count() == 0) {
     status->showMessage(connectionsLayout.at(0)->getUDTStats());
@@ -341,5 +347,5 @@
     QDomDocument doc("remote_ui_xml");
     connectionsLayout.at(i)->GetUpdateXml((QDomElement *)&doc);
-    // printf("merge\n%s\n",doc.toString().toLocal8Bit().constData());
+    // fprintf(stderr,"merge\n%s\n",doc.toString().toLocal8Bit().constData());
 
     connectionsLayout.at(i)->XmlToSend(doc);
Index: trunk/tools/FlairGCS/src/Manager.h
===================================================================
--- trunk/tools/FlairGCS/src/Manager.h	(revision 242)
+++ trunk/tools/FlairGCS/src/Manager.h	(revision 244)
@@ -53,4 +53,5 @@
   void deleteFileUI(void);
   void newConnectionLayout(QString name);
+  void udtSocketDestroyed(QObject *obj);
   void layoutDestroyed(QObject *obj);
 
Index: trunk/tools/FlairGCS/src/Map.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Map.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/Map.cpp	(revision 244)
@@ -82,5 +82,5 @@
             SLOT(changeproxy(int)));
   } else {
-    printf("Error, no services!\n");
+    fprintf(stderr,"Error, no services!\n");
     mapWidget->setEnabled(false);
   }
Index: trunk/tools/FlairGCS/src/Picture.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Picture.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/Picture.cpp	(revision 244)
@@ -48,5 +48,5 @@
                        bool big_endian) {
   if (big_endian)
-    printf("Picture::BufEvent, big endian not handled\n");
+    fprintf(stderr,"Picture::BufEvent, big endian not handled\n");
 
   if (IsEnabled() == false || RefreshRate_ms() != period)
@@ -61,5 +61,5 @@
     label->setPixmap(QPixmap::fromImage(image));
   } else
-    printf("buffer trop petit\n");
+    fprintf(stderr,"buffer trop petit\n");
 }
 
Index: trunk/tools/FlairGCS/src/RangeFinderPlot.cpp
===================================================================
--- trunk/tools/FlairGCS/src/RangeFinderPlot.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/RangeFinderPlot.cpp	(revision 244)
@@ -39,5 +39,5 @@
     receivesize = nb_samples * sizeof(int16_t);
   } else {
-    printf("RangeFinderPlot::RangeFinderPlot unknown type %s\n",
+    fprintf(stderr,"RangeFinderPlot::RangeFinderPlot unknown type %s\n",
            data_type.toLocal8Bit().constData());
   }
@@ -177,5 +177,5 @@
       SetTriangle(i, data);
     } else {
-      printf("RangeFinderPlot::BufEvent unknown type %s\n",
+      fprintf(stderr,"RangeFinderPlot::BufEvent unknown type %s\n",
              data_type.toLocal8Bit().constData());
     }
Index: trunk/tools/FlairGCS/src/UdtSocket.cpp
===================================================================
--- trunk/tools/FlairGCS/src/UdtSocket.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/UdtSocket.cpp	(revision 244)
@@ -39,5 +39,5 @@
   bool blocking = false;
   if (UDT::setsockopt(socket, 0, UDT_RCVSYN, &blocking, sizeof(bool)) != 0)
-    printf("UDT::setsockopt error (UDT_RCVSYN)\n");
+    fprintf(stderr,"UDT::setsockopt error (UDT_RCVSYN)\n");
     
   heartbeat_timer = new QTimer(this);
@@ -57,5 +57,5 @@
 
 void UdtSocket::setName(QString name) {
-  printf("  %s is %s\n",this->name.toLocal8Bit().constData(),name.toLocal8Bit().constData());
+  fprintf(stderr,"  %s is %s\n",this->name.toLocal8Bit().constData(),name.toLocal8Bit().constData());
   this->name=name;
 }
@@ -79,17 +79,17 @@
   UDT::TRACEINFO perf;
   if (UDT::ERROR == UDT::perfmon(socket, &perf))   {
-    printf("perfmon: %s\n",UDT::getlasterror().getErrorMessage());
+    fprintf(stderr,"perfmon: %s\n",UDT::getlasterror().getErrorMessage());
   }/* else {
-    printf("%s socket stats:\n",name.toLocal8Bit().constData());
-    printf("total number of sent packets, including retransmissions: %i\n",perf.pktSentTotal);
-    printf("total number of received packets: %i\n",perf.pktRecvTotal);
-    printf("total number of lost packets, measured in the sending side: %i\n",perf.pktSndLossTotal);
-    printf("total number of lost packets, measured in the receiving side: %i\n",perf.pktRcvLossTotal);
-    printf("total number of retransmitted packets, measured in the sending side: %i\n",perf.pktRetransTotal);
-    printf("total number of sent ACK packets: %i\n",perf.pktSentACKTotal);
-    printf("total number of received ACK packets: %i\n",perf.pktRecvACKTotal);
-    printf("total number of sent NAK packets: %i\n",perf.pktSentNAKTotal);
-    printf("total number of received NAK packets: %i\n",perf.pktRecvNAKTotal);
-    printf("round trip time: %fms\n",perf.msRTT);
+    fprintf(stderr,"%s socket stats:\n",name.toLocal8Bit().constData());
+    fprintf(stderr,"total number of sent packets, including retransmissions: %i\n",perf.pktSentTotal);
+    fprintf(stderr,"total number of received packets: %i\n",perf.pktRecvTotal);
+    fprintf(stderr,"total number of lost packets, measured in the sending side: %i\n",perf.pktSndLossTotal);
+    fprintf(stderr,"total number of lost packets, measured in the receiving side: %i\n",perf.pktRcvLossTotal);
+    fprintf(stderr,"total number of retransmitted packets, measured in the sending side: %i\n",perf.pktRetransTotal);
+    fprintf(stderr,"total number of sent ACK packets: %i\n",perf.pktSentACKTotal);
+    fprintf(stderr,"total number of received ACK packets: %i\n",perf.pktRecvACKTotal);
+    fprintf(stderr,"total number of sent NAK packets: %i\n",perf.pktSentNAKTotal);
+    fprintf(stderr,"total number of received NAK packets: %i\n",perf.pktRecvNAKTotal);
+    fprintf(stderr,"round trip time: %fms\n",perf.msRTT);
       
   }*/
@@ -114,14 +114,14 @@
   char *buf = (char *)malloc(buf_size);
   if (!buf) {
-    printf("error malloc UdtSocket::receiveData buffer\n");
+    fprintf(stderr,"error malloc UdtSocket::receiveData buffer\n");
     return;
   }
   char *uncompressbuf=(char *)malloc(COMPRESS_CHUNK);
   if (!uncompressbuf) {
-    printf("error malloc UdtSocket::receiveData uncompress buffer\n");
+    fprintf(stderr,"error malloc UdtSocket::receiveData uncompress buffer\n");
     free(buf);
     return;
   }
-  //fprintf(stderr,"receiveData %x\n",thread());
+  //ffprintf(stderr,stderr,"receiveData %x\n",thread());
   
   while (!stop) {
@@ -135,15 +135,15 @@
     int eid = UDT::epoll_create();
     if (eid < 0) {
-      printf("%s: epoll_create error (%s)\n",name.toLocal8Bit().constData(),UDT::getlasterror().getErrorMessage());
+      fprintf(stderr,"%s: epoll_create error (%s)\n",name.toLocal8Bit().constData(),UDT::getlasterror().getErrorMessage());
     }
 
     if (UDT::epoll_add_usock(eid, socket) < 0) {
       if (UDT::getlasterror().getErrorCode() == 5004) {
-        printf("disconnected from %s\n",name.toLocal8Bit().constData());
+        fprintf(stderr,"disconnected from %s\n",name.toLocal8Bit().constData());
         heartbeat_timer->stop();
         deleteLater();
         stop=true;;
       } else {
-        printf("%s: epoll_add_usock error (%s)\n",name.toLocal8Bit().constData(),UDT::getlasterror().getErrorMessage());
+        fprintf(stderr,"%s: epoll_add_usock error (%s)\n",name.toLocal8Bit().constData(),UDT::getlasterror().getErrorMessage());
       }
     }
@@ -155,5 +155,5 @@
     if (rv == -1) {
       if (UDT::getlasterror().getErrorCode() != 6003)
-        printf("prob %i\n", UDT::getlasterror().getErrorCode());
+        fprintf(stderr,"prob %i\n", UDT::getlasterror().getErrorCode());
     } else if(readfds==socket && num==1 && rv==1) {
        
@@ -201,5 +201,5 @@
       } else {
         if(UDT::getlasterror().getErrorCode()!=6002) 
-          printf("udt socket:%s %i\n",UDT::getlasterror().getErrorMessage(),size);
+          fprintf(stderr,"udt socket: %s %i\n",UDT::getlasterror().getErrorMessage(),size);
         //UDT::close(socket);//si deconnecté
         //free(buf);
@@ -207,5 +207,5 @@
       }
     } else {
-      printf("udt socket:%s\n",UDT::getlasterror().getErrorMessage());
+      fprintf(stderr,"udt socket: %s\n",UDT::getlasterror().getErrorMessage());
     }
     UDT::epoll_remove_usock(eid, socket);
@@ -220,6 +220,7 @@
   qint64 sent = UDT::sendmsg(socket, buf, size, ttl, inOrder);
   if (sent != size) {
-    printf("%s, error writting to udt (%s)\n",name.toLocal8Bit().constData(), UDT::getlasterror().getErrorMessage());
+    fprintf(stderr,"%s, error writting to udt (%s)\n",name.toLocal8Bit().constData(), UDT::getlasterror().getErrorMessage());
     if (UDT::getlasterror().getErrorCode() == 2001) {
+      fprintf(stderr,"%s, closing connection\n",name.toLocal8Bit().constData());
       stop = true;
       heartbeat_timer->stop();
Index: trunk/tools/FlairGCS/src/UsSensorPlot.cpp
===================================================================
--- trunk/tools/FlairGCS/src/UsSensorPlot.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/UsSensorPlot.cpp	(revision 244)
@@ -97,5 +97,5 @@
     receivesize += sizeof(int16_t);
   } else {
-    printf("UsSensorPlot::unknown type %s\n",
+    fprintf(stderr,"UsSensorPlot::unknown type %s\n",
            datasType.toLocal8Bit().constData());
   }
@@ -217,5 +217,5 @@
     *buf += nbSamples*sizeof(uint16_t);
   } else {
-    printf("UsSensorPlot::DrawDatas type non connu %s\n",datasType.toLocal8Bit().constData());
+    fprintf(stderr,"UsSensorPlot::DrawDatas type non connu %s\n",datasType.toLocal8Bit().constData());
   }
   uint16_t *data=(uint16_t*)*buf;
Index: trunk/tools/FlairGCS/src/XmlWidget.cpp
===================================================================
--- trunk/tools/FlairGCS/src/XmlWidget.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/XmlWidget.cpp	(revision 244)
@@ -73,11 +73,11 @@
 
 XmlWidget *XmlWidget::GetXmlWidget(QString name, QString type) {
-  // printf("recherche %s
+  // fprintf(stderr,"recherche %s
   // %s\n",name.toLocal8Bit().constData(),type.toLocal8Bit().constData());
 
   for (int i = 0; i < childs->count(); i++) {
-    // printf("child name
+    // fprintf(stderr,"child name
     // %s\n",childs->at(i)->write_elem.attribute("name").toLocal8Bit().constData());
-    // printf("child tag
+    // fprintf(stderr,"child tag
     // %s\n",childs->at(i)->write_elem.tagName().toLocal8Bit().constData());
     if (childs->at(i)->write_elem.attribute("name") == name &&
@@ -96,5 +96,5 @@
   QString name = to_parse.attribute("name");
 
-  // printf("parse %s
+  // fprintf(stderr,"parse %s
   // %s\n",type.toLocal8Bit().constData(),name.toLocal8Bit().constData());
   XmlWidget *match;
@@ -102,8 +102,8 @@
 
   if (match == NULL) {
-    // printf("not match\n");
+    // fprintf(stderr,"not match\n");
     XmlEvent(to_parse);
   } else {
-    // printf("match\n");
+    // fprintf(stderr,"match\n");
     // si on a une balise IsEnabled, on ne traite que ca
     if (match->visible_widget != NULL) {
@@ -120,7 +120,7 @@
     // si on a une balise delete, on ne traite que ca
     if (to_parse.attribute("Delete") == "1") {
-      // printf("delete flag\n");
+      // fprintf(stderr,"delete flag\n");
       if (match->isContainer == true && match->childs->count() != 0) {
-        // printf("non vide
+        // fprintf(stderr,"non vide
         // %s\n",match->objectName().toLocal8Bit().constData());
         return;
@@ -134,5 +134,5 @@
         match->isExpandable == false) {
       QString new_name;
-      printf("possible doublon\n");
+      fprintf(stderr,"possible doublon\n");
       for (int i = 0; i < 65535; i++) {
         new_name = QString("%1_%2").arg(name).arg(i);
@@ -147,5 +147,5 @@
           break;
       }
-      printf("new_name %s\n", new_name.toLocal8Bit().constData());
+      fprintf(stderr,"new_name %s\n", new_name.toLocal8Bit().constData());
       to_parse.setAttribute("name", new_name);
       to_parse.setAttribute("old_name", name);
@@ -177,5 +177,5 @@
     QString type = elem.tagName();
     QString name = elem.attribute("name");
-    // printf("%s
+    // fprintf(stderr,"%s
     // %s\n",type.toLocal8Bit().constData(),name.toLocal8Bit().constData());
     XmlWidget *match;
@@ -183,5 +183,5 @@
 
     if (match != NULL) {
-      // printf("match\n");
+      // fprintf(stderr,"match\n");
       match->LoadXml(elem);
     }
@@ -296,5 +296,5 @@
   QDomNamedNodeMap attributes=write_elem.attributes();
   while(attributes.count()!=0) {
-    //printf("%i %s\n",attributes.count(),attributes.item(0).toAttr().name().toLocal8Bit().constData());
+    //fprintf(stderr,"%i %s\n",attributes.count(),attributes.item(0).toAttr().name().toLocal8Bit().constData());
     write_elem.removeAttribute(attributes.item(0).toAttr().name());
   }
Index: trunk/tools/FlairGCS/src/file_ui.cpp
===================================================================
--- trunk/tools/FlairGCS/src/file_ui.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/file_ui.cpp	(revision 244)
@@ -34,5 +34,5 @@
   bool blocking = true;
   if (UDT::setsockopt(socket, 0, UDT_SNDSYN, &blocking, sizeof(bool))!= 0) {
-    printf("UDT::setsockopt error (UDT_SNDSYN) %s\n",UDT::getlasterror().getErrorMessage());
+    fprintf(stderr,"UDT::setsockopt error (UDT_SNDSYN) %s\n",UDT::getlasterror().getErrorMessage());
   }
     
@@ -42,8 +42,8 @@
   
   if (UDT::setsockopt(socket, 0, UDT_LINGER, &_linger, sizeof(struct linger)) != 0)
-    printf("UDT::setsockopt error (UDT_LINGER) %s\n",UDT::getlasterror().getErrorMessage());
+    fprintf(stderr,"UDT::setsockopt error (UDT_LINGER) %s\n",UDT::getlasterror().getErrorMessage());
     
   dialog = new QDialog();
-//fprintf(stderr,"creator file ui %x\n",thread());
+//ffprintf(stderr,stderr,"creator file ui %x\n",thread());
   dialog->setWindowTitle("log files");
   QGridLayout *main_layout = new QGridLayout(dialog);
@@ -86,5 +86,5 @@
   bool flag_new_seq = true;
   QString folder_name;
-//fprintf(stderr,"file_ui thread %x\n",thread());
+//ffprintf(stderr,stderr,"file_ui thread %x\n",thread());
   while(1) {
     // receive file info
@@ -101,5 +101,5 @@
       size = qFromBigEndian(size);
 
-    // printf("file_ui recu %i %x\n",bytesRead,recv_buf[0]);
+    // fprintf(stderr,"file_ui recu %i %x\n",bytesRead,recv_buf[0]);
     if ((recv_buf[0]==FILE_INFO_LITTLE_ENDIAN || recv_buf[0]==FILE_INFO_BIG_ENDIAN) && size>0) {
       if (flag_new_seq == true) {
@@ -148,5 +148,5 @@
       endOfFiles();
       UDT::close(socket);
-      printf("disconnected from log files\n");
+      fprintf(stderr,"disconnected from log files\n");
       break;
     }
@@ -221,5 +221,5 @@
     QString txt_line = txt_in.readLine();
     data_type.append(txt_line.section("(",-1)); // on part de la fin pour trouver la premiere parenthese ouvrante
-    // printf("type %s\n",txt_line.section("(",-1).toLocal8Bit().constData());
+    // fprintf(stderr,"type %s\n",txt_line.section("(",-1).toLocal8Bit().constData());
   }
   txt_file.close();
@@ -323,5 +323,5 @@
   QFile file(filename);
   if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
-    printf("file_ui::save_comment: erreur ouverture fichier %s\n",
+    fprintf(stderr,"file_ui::save_comment: erreur ouverture fichier %s\n",
            filename.toLocal8Bit().constData());
   QTextStream out(&file);
@@ -337,5 +337,5 @@
   QFile global_file(filename);
   if (!global_file.open(QIODevice::WriteOnly | QIODevice::Text))
-    printf("file_ui::save_csv: erreur ouverture fichier %s\n",
+    fprintf(stderr,"file_ui::save_csv: erreur ouverture fichier %s\n",
            filename.toLocal8Bit().constData());
   QTextStream out(&global_file);
@@ -344,7 +344,7 @@
   filename = file_names->at(csv_combo->currentIndex() - 1);
   QFile ref_file(filename);
-  // printf("file_ui::save_csv: ref %s\n",filename.toLocal8Bit().constData());
+  // fprintf(stderr,"file_ui::save_csv: ref %s\n",filename.toLocal8Bit().constData());
   if (!ref_file.open(QIODevice::ReadOnly | QIODevice::Text))
-    printf("file_ui::save_csv: erreur ouverture ficher %s\n",
+    fprintf(stderr,"file_ui::save_csv: erreur ouverture ficher %s\n",
            filename.toLocal8Bit().constData());
 
@@ -359,5 +359,5 @@
     m_file[j].setFileName(filename);
     if (!m_file[j].open(QIODevice::ReadOnly | QIODevice::Text))
-      printf("file_ui::save_csv: erreur ouverture ficher %s\n",
+      fprintf(stderr,"file_ui::save_csv: erreur ouverture ficher %s\n",
              filename.toLocal8Bit().constData());
     m_in[j].setDevice(&m_file[j]);
@@ -382,10 +382,10 @@
     qint64 ref_us = ref_line.section(',', 0, 0).toLongLong();
     int ref_ns = ref_line.section(',', 1, 1).toInt();
-    // printf("ref %lld %i\n",ref_us,ref_ns);
+    // fprintf(stderr,"ref %lld %i\n",ref_us,ref_ns);
 
     for (int i = 0; i < file_names->count() - 1; i++) {
       qint64 csv_us = m_line[i].section(',', 0, 0).toLongLong();
       int csv_ns = m_line[i].section(',', 1, 1).toInt();
-      // printf("m %lld %i\n",csv_us,csv_ns);
+      // fprintf(stderr,"m %lld %i\n",csv_us,csv_ns);
 
       while (is_greater(ref_us, csv_us, ref_ns, csv_ns) == true) {
@@ -396,9 +396,9 @@
         csv_us = m_line[i].section(',', 0, 0).toLongLong();
         csv_ns = m_line[i].section(',', 1, 1).toInt();
-        // printf("m %lld %i\n",csv_us,csv_ns);
+        // fprintf(stderr,"m %lld %i\n",csv_us,csv_ns);
       }
       csv_us = m_line_prev[i].section(',', 0, 0).toLongLong();
       csv_ns = m_line_prev[i].section(',', 1, 1).toInt();
-      // printf("m ok %lld %i\n",csv_us,csv_ns);
+      // fprintf(stderr,"m ok %lld %i\n",csv_us,csv_ns);
 
       ref_line += "," + m_line_prev[i].section(',', 2);
@@ -420,5 +420,5 @@
   QFile global_file(filename);
   if (!global_file.open(QIODevice::WriteOnly | QIODevice::Text))
-    printf("file_ui::save_txt: erreur ouverture ficher %s\n",
+    fprintf(stderr,"file_ui::save_txt: erreur ouverture ficher %s\n",
            filename.toLocal8Bit().constData());
   QTextStream out(&global_file);
@@ -429,5 +429,5 @@
   QFile ref_file(filename);
   if (!ref_file.open(QIODevice::ReadOnly | QIODevice::Text))
-    printf("file_ui::save_txt: erreur ouverture ficher %s\n",
+    fprintf(stderr,"file_ui::save_txt: erreur ouverture ficher %s\n",
            filename.toLocal8Bit().constData());
 
@@ -450,5 +450,5 @@
     QFile txt_file(filename);
     if (!txt_file.open(QIODevice::ReadOnly | QIODevice::Text))
-      printf("file_ui::save_txt: erreur ouverture ficher %s\n",
+      fprintf(stderr,"file_ui::save_txt: erreur ouverture ficher %s\n",
              filename.toLocal8Bit().constData());
     QTextStream txt_in(&txt_file);
Index: trunk/tools/FlairGCS/src/main.cpp
===================================================================
--- trunk/tools/FlairGCS/src/main.cpp	(revision 242)
+++ trunk/tools/FlairGCS/src/main.cpp	(revision 244)
@@ -46,5 +46,5 @@
   int nentries;
 
-  printf("Segmentation fault:\n");
+  fprintf(stderr,"Segmentation fault:\n");
   /* Dump a backtrace of the frame which caused the segfault: */
   nentries = backtrace(bt, sizeof(bt) / sizeof(bt[0]));
@@ -62,5 +62,5 @@
 
   if (bint.c[0] == 1) {
-    printf("error, ground station is only compatible with little endian\n");
+    fprintf(stderr,"error, ground station is only compatible with little endian\n");
     return -1;
   }
@@ -72,5 +72,5 @@
 
   parseOptions(argc, argv);
-  printf("listening on port %i\n", port);
+  fprintf(stderr,"listening on port %i\n", port);
 
   qRegisterMetaType<const char *>("const char*");
