Exemplo n.º 1
0
void BinStreamable::writeToBinFile(const char *filename, 
                                   Format compression) const
{
  switch(compression) {
    case BIN: {
      ofbinstream file(filename);
      if (!file.good()) {
        fthrow(Exception, "writeToBinFile(): could not open file.");
      }
      writeBin(file);
      file.close();
      break;
    }
#ifdef NICE_USELIB_ZLIB
    case BIN_GZ: {
      ogzbinstream file(filename);
      if (!file.good()) {
        fthrow(Exception, "writeToBinFile(): could not open file.");
      }
      writeBin(file);
      file.close();
      break;
    }
#endif
    default:
      fthrow(Exception,
             "File cannot be written! Compression method not supported.");
      break;
  }
}
Exemplo n.º 2
0
bool File::writeBin(const char *str){
    return writeBin((edk::char8 *)str);
}