00001 #pragma ident "$Id: rinex_obs_read_write.cpp 1895 2009-05-12 19:34:29Z afarris $"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00029 #include "RinexObsBase.hpp"
00030 #include "RinexObsData.hpp"
00031 #include "RinexObsHeader.hpp"
00032 #include "RinexObsStream.hpp"
00033
00034 using namespace std;
00035
00037 main(int argc, char *argv[])
00038 {
00039
00040 if (argc<2)
00041 {
00042 cout << "rinex_obs_read_write inputfile outputfile" << endl;
00043 exit(-1);
00044 }
00045
00046 try
00047 {
00048 cout << "Reading " << argv[1] << endl;
00049 gpstk::RinexObsStream roffs(argv[1]);
00050 cout << "Writing " << argv[2] << endl;
00051 gpstk::RinexObsStream out(argv[2], ios::out);
00052 roffs.exceptions(ios::failbit);
00053 gpstk::RinexObsHeader roh;
00054 gpstk::RinexObsData roe;
00055
00056 roffs >> roh;
00057 out << roh;
00058 roh.dump(cout);
00059
00060 while (roffs >> roe)
00061 {
00062 out << roe;
00063 }
00064
00065 cout << "Read " << roffs.recordNumber << " epochs. Done." << endl;
00066 exit(0);
00067 }
00068 catch(gpstk::FFStreamError& e)
00069 {
00070 cout << e;
00071 exit(1);
00072 }
00073 catch(gpstk::Exception& e)
00074 {
00075 cout << e;
00076 exit(1);
00077 }
00078 catch (...)
00079 {
00080 cout << "unknown error. Done." << endl;
00081 exit(1);
00082 }
00083
00084 exit(0);
00085 }