示例#1
0
//------------------------------------------------------------------------------------
int OpenFiles(void) throw(Exception)
{
try {
   string filename;
   if(InputDirectory.empty())
      filename = NovatelFile;
   else
      filename = InputDirectory + string("/") + NovatelFile;
   instr.open(filename.c_str(),ios::in | ios::binary);
   if(!instr.is_open()) {
      cerr << "Failed to open input file " << NovatelFile << endl;
      return -1;
   }
   if(verbose) cout << "Opened input file " << NovatelFile << endl;
   instr.exceptions(fstream::failbit);

   TempFileName = GetTempFileName();
   rostr.open(TempFileName.c_str(),ios::out);
   if(!rostr.is_open()) {
      cerr << "Failed to open temporary output file " << TempFileName << endl;
      return -2;
   }
   rostr.exceptions(fstream::failbit);

   rnstr.open(RinexNavFile.c_str(),ios::out);
   if(!rnstr.is_open()) {
      cerr << "Failed to open output nav file " << RinexNavFile << endl;
      return -3;
   }
   if(verbose) cout << "Opened output nav file " << RinexNavFile << endl;
   rnstr.exceptions(fstream::failbit);

   return 0;
}
catch(Exception& e) { GPSTK_RETHROW(e); }
catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); }
catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); }
}