sac2asc.cpp
Go to the documentation of this file.00001 #include "SeismicDataComp.h"
00002 #include "FatalException.h"
00003 #include <iostream>
00004 #include <string>
00005 #include "Util.h"
00006
00007 using namespace std;
00008 using namespace gplib;
00009
00010 string version = "$Id: sac2asc.cpp 1816 2009-09-07 11:28:35Z mmoorkamp $";
00011
00012 int main(int argc, char *argv[])
00013 {
00014 cout << " This is sac2asc: Convert sac to plain ascii format" << endl;
00015 cout << " Reads in a file in SAC format and writes it as an ascii file"
00016 << endl;
00017 cout
00018 << " Most header values are ignored, only npts, dt and b are written to the output file"
00019 << endl;
00020 cout << " This is Version: " << version << endl << endl;
00021
00022 SeismicDataComp Input;
00023 string outfilename, infilename;
00024 try
00025 {
00026 if (argc > 1)
00027 infilename = argv[1];
00028 else
00029 {
00030 infilename = AskFilename("Input file: ");
00031 }
00032 outfilename = infilename + ".asc";
00033
00034 Input.ReadData(infilename);
00035 Input.WriteAsAscii(outfilename);
00036 } catch (FatalException &e)
00037 {
00038 cerr << e.what() << endl;
00039 return -1;
00040 }
00041
00042 }