Go to the documentation of this file.00001 #include <iostream>
00002 #include <fstream>
00003 #include <sstream>
00004 #include <cstring>
00005
00006 using namespace std;
00007
00008 int main(int argc, char**argv){
00009 if (argc<3){
00010 cout << "usage gfs2neff <infilename> <nefffilename>" << endl;
00011 return -1;
00012 }
00013 ifstream is(argv[1]);
00014 if (!is){
00015 cout << "could read file "<< endl;
00016 return -1;
00017 }
00018 ofstream os(argv[2]);
00019 if (! os){
00020 cout << "could write file "<< endl;
00021 return -1;
00022 }
00023 unsigned int frame=0;
00024 double neff=0;
00025 while(is){
00026 char buf[8192];
00027 is.getline(buf, 8192);
00028 istringstream lineStream(buf);
00029 string recordType;
00030 lineStream >> recordType;
00031 if (recordType=="FRAME"){
00032 lineStream>> frame;
00033 }
00034 if (recordType=="NEFF"){
00035 lineStream>> neff;
00036 os << frame << " " << neff << endl;
00037 }
00038 }
00039 os.close();
00040 }