Index: /trunk/SophyaExt/FitsIOServer/fitsblkrw.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsblkrw.h	(revision 2842)
+++ /trunk/SophyaExt/FitsIOServer/fitsblkrw.h	(revision 2843)
@@ -114,4 +114,72 @@
 };
 
+
+/*! 
+  Write character string data to binary/ascii HDU data in a fits file. 
+  See cfitsio function fits_write_col() for more detail.
+  \param colnum : table column number (starting from 1)
+  \param firstrow : the write operation starting row (starting from 1)
+  \param firstelem : the firstelem (for vector type columns)
+  \param d : pointer to string type array to be written
+  \param sz : number of data elements to be written
+  \param width : column width
+*/
+void WriteStringColumnData(FitsInOutFile& fios, int colnum, long firstrow,
+			   long firstelem, const string * d, size_t sz, 
+			   long width=0)
+{
+  int status = 0;
+  if (width < 1) width = 16;
+  for(size_t kk=0; kk<sz; kk++) {
+    char * cp = const_cast<char *>(d[kk].c_str());
+    status = 0;
+    fits_write_col(fios.FitsPtr(), FitsTypes::DataType(cp), colnum,
+		   firstrow+kk, firstelem, 1, &cp, &status);
+    if ( status ) {
+      fits_report_error(stderr, status);
+      char buff[32];
+      fits_get_errstatus(status, buff);
+      string msg = "WriteStringColumnData Error: " ;
+      msg += buff;
+      sprintf(buff," kk=%ld",kk);  msg += buff;
+      throw FitsIOException(msg);
+    }
+  }
+  return;
+}
+
+/*! 
+  Read character string data to binary/ascii HDU data in a fits file. 
+  See cfitsio function fits_read_col() for more detail.
+  \param colnum : table column number (starting from 1)
+  \param firstrow : the read operation starting point (row) (starting from 1)
+  \param firstelem : the firstelem (for vector type columns)
+  \param d : pointer to string type array to be read
+  \param sz : number of data elements to be read
+  \param width : column width
+*/
+void ReadStringColumnData(FitsInOutFile& fios, int colnum, long firstrow,
+			  long firstelem, string * d, size_t sz, long width)
+{
+  int status = 0;
+  int anynul = 0;
+  char buff[1024];
+  for(size_t kk=0; kk<sz; kk++) {
+    fits_read_col(fios.FitsPtr(), FitsTypes::DataType(buff), colnum,
+		 firstrow, firstelem+kk, 1, NULL, &buff, &anynul, &status);
+    d[kk] = buff;
+    if ( status ) {
+      fits_report_error(stderr, status);
+      char buff[32];
+      fits_get_errstatus(status, buff);
+      string msg = "ReadStringColumnData Error: " ;
+      msg += buff;
+      sprintf(buff," kk=%ld",kk);  msg += buff;
+      throw FitsIOException(msg);
+    }
+  }
+  return;
+}
+
 } // Fin du namespace
 
Index: /trunk/SophyaExt/FitsIOServer/fitshdtable.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitshdtable.cc	(revision 2842)
+++ /trunk/SophyaExt/FitsIOServer/fitshdtable.cc	(revision 2843)
@@ -217,4 +217,5 @@
 
 
+/*
 int toto()
 {
@@ -224,4 +225,5 @@
   //  fio << xx;
 }
-
-
+*/
+
+
Index: /trunk/SophyaExt/FitsIOServer/fitsinoutfile.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsinoutfile.cc	(revision 2842)
+++ /trunk/SophyaExt/FitsIOServer/fitsinoutfile.cc	(revision 2843)
@@ -7,4 +7,86 @@
 #include <iostream>
 
+string FitsTypes::ImageTypeToTypeString(int ityp)
+{
+  switch (ityp) {
+  case BYTE_IMG :
+    return "uint_1";
+    break;
+  case SHORT_IMG :
+    return "int_2";
+    break;
+  case LONG_IMG :
+    return "int_4";
+    break;
+  case FLOAT_IMG :
+    return "r_4";
+    break;
+  case DOUBLE_IMG :
+    return "r_8";
+    break;
+  default:
+    return "???" ;
+    break;
+  }
+  return "";
+}
+string FitsTypes::DataTypeToTypeString(int ityp)
+{
+  switch (ityp) {
+  case TBYTE :
+    return "uint_1";
+    break;
+  case TSHORT :
+    return "int_2";
+    break;
+  case TUSHORT :
+    return "uint_2";
+    break;
+  case TINT :
+    if (sizeof(int) == 4)  return "int_4";
+    else if (sizeof(int) == 8)  return "int_8";
+    else if (sizeof(int) == 2)  return "int_2";
+    break;
+  case TUINT :
+    if (sizeof(int) == 4)  return "uint_4";
+    else if (sizeof(int) == 8)  return "uint_8";
+    else if (sizeof(int) == 2)  return "uint_2";
+    break;
+  case TLONG :
+    if (sizeof(long) == 4)  return "int_4";
+    else if (sizeof(long) == 8)  return "int_8";
+    else if (sizeof(long) == 2)  return "int_2";
+    break;
+  case TULONG :
+    if (sizeof(long) == 4)  return "uint_4";
+    else if (sizeof(long) == 8)  return "uint_8";
+    else if (sizeof(long) == 2)  return "uint_2";
+    break;
+#ifdef TLONGLONG
+  case TLONGLONG :
+    return "int_8";
+    break;
+#endif
+  case TFLOAT :
+    return "r_4";
+    break;
+  case TDOUBLE :
+    return "r_8";
+    break;
+  case TCOMPLEX : 
+    return "complex< r_4 >";
+    break;
+  case TDBLCOMPLEX : 
+    return "complex< r_8 >";
+    break;
+  case TSTRING : 
+    return "string";
+    break;
+  default:
+    return "???" ;
+    break;
+  }
+  return "";
+}
 
 /*! 
@@ -20,4 +102,5 @@
   fptr_ = NULL;
   SetDef_BinTable();
+  SetDef_StrColWidth();
 }
 
@@ -29,4 +112,5 @@
   fptr_ = NULL;
   SetDef_BinTable();
+  SetDef_StrColWidth();
   Open(name.c_str(), mode);
 }
@@ -39,4 +123,5 @@
   fptr_ = NULL;
   SetDef_BinTable();
+  SetDef_StrColWidth();
   Open(name, mode);
 }
@@ -106,5 +191,5 @@
     fits_movabs_hdu(FitsPtr() , 1, &hdutyp, &status);
     status = 0;
-    float sfv = 2.0;
+    float sfv = Version();
     fits_write_key(FitsPtr(), TFLOAT, "SOPHYAFV", &sfv, 
 		   "SOPHYA FitsIOServer module version", &status);
@@ -376,9 +461,19 @@
 
 /*-- Methode --*/
-string FitsInOutFile::KeyValue(string const & key)
-{
+/*!
+  Return the value associated to the keyword \b key in the header as a string.
+  If the keyword is not found in the fits header, an empty string is returned 
+  and the \b nosk flag is set to true.
+*/
+string FitsInOutFile::KeyValue(string const & key, bool& nosk)
+{
+  nosk = false;
   int status = 0;
   char value[FLEN_VALUE], comm[FLEN_COMMENT];
   fits_read_key(FitsPtr(), TSTRING, const_cast<char *>(key.c_str()), value, comm, &status);
+  if (status == KEY_NO_EXIST) {
+    nosk = true;
+    return "";
+  }
   FitsCheckStatus(status, "FitsInOutFile::KeyValue() Error: ");
   return value;
Index: /trunk/SophyaExt/FitsIOServer/fitsinoutfile.h
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsinoutfile.h	(revision 2842)
+++ /trunk/SophyaExt/FitsIOServer/fitsinoutfile.h	(revision 2843)
@@ -63,4 +63,6 @@
  static int DataType(complex<r_8>  d)   { return TDBLCOMPLEX; }
 
+ static int DataType(char*  d)   { return TSTRING; }
+
  // Conversion entre type FITS et chaine - exemple TFLOAT -> r_4 
  static string ImageTypeToTypeString(int ityp);
@@ -88,4 +90,6 @@
  inline fitsfile*  FitsPtr() const { return fptr_; }
  static float      cfitsioVersion();
+ //! Return the SOPHYA FitsIOServer version 
+ static float      Version() { return 2.0; }
 
  //---- Header manipulation methods
@@ -150,4 +154,9 @@
  inline int         GetDef_TableType() { return def_tbltype; }
 
+ //! Defines default column width for strings (Aw) 
+ inline void        SetDef_StrColWidth(long w=16) { def_strcolw = w; }
+ //! Return default column width for strings (Aw)
+ inline long        GetDef_StrColWidth() { return def_strcolw; } 
+
  //! Insert (add) a new column
  void              InsertColumn(int numcol, const char* colname, const char* fmt);
@@ -158,6 +167,9 @@
 
  // Manipulation des informations de l'entete 
- //! Returns a given keyword value
-  string           KeyValue(string const & key);
+ //! Retrieve a keyword value from the header 
+  inline string    KeyValue(string const & key)
+    { bool nosk; return KeyValue(key, nosk); }
+ //! Retrieve a keyword value from the header 
+  string           KeyValue(string const & key, bool& nosk);
  //! Read header records and appends the information to dvl
  int               GetHeaderRecords(DVList& dvl);
@@ -184,4 +196,6 @@
  // Default table type 
  int def_tbltype;
+ // default column width for strings 
+ long def_strcolw;
 };
 
Index: /trunk/SophyaExt/FitsIOServer/fitsmanager.cc
===================================================================
--- /trunk/SophyaExt/FitsIOServer/fitsmanager.cc	(revision 2842)
+++ /trunk/SophyaExt/FitsIOServer/fitsmanager.cc	(revision 2843)
@@ -21,5 +21,5 @@
 static inline void ChkHLP() 
 {
-  if (hlistp = NULL) hlistp = new HandlerList;
+  if (hlistp == NULL) hlistp = new HandlerList;
 }
 
