source: branches/AddingGoogleTestEnvironment/mtemp/mwuerzburg/tools/dcconverter/main.cpp@ 19779

Last change on this file since 19779 was 4091, checked in by merck, 21 years ago
Merck: First commit to CVS
File size: 1.6 KB
Line 
1/***************************************************************************
2 main.cpp - description
3 -------------------
4 begin : Tue Dec 9 12:05:18 CET 2003
5 copyright : (C) 2003 by Martin Merck
6 email : merck@astro.uni-wuerzburg.de
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is part of the MAGIC Software * ***************************************************************************/
12
13#ifndef GLOBALS_INCLUDED
14#include "Globals.h"
15#endif
16
17#include <iostream>
18#include <fstream>
19#include <sstream>
20#include <iterator>
21#include <string>
22#include <stdlib.h>
23#include "DCCurrentEvent.h"
24
25using namespace std;
26
27int gYear, gMonth, gDay;
28
29void usage();
30
31int main(int argc, char *argv[])
32{
33 if (argc != 3)
34 usage();
35
36 string dcFileName( argv[1] );
37 string date = dcFileName.substr( dcFileName.rfind( "dc_" ) + 3, 10 );
38 sscanf( date.c_str(), "%d_%d_%d", &gYear, &gMonth, &gDay);
39 cout << gYear << ":" << gMonth << ":" << gDay << endl;
40
41
42 std::ifstream input( argv[1] );
43 ofstream output( const_cast<const char *> (argv[2]) );
44
45 copy( istream_iterator<DCCurrentEvent>( input ),
46 istream_iterator<DCCurrentEvent>(),
47 ostream_iterator<DCCurrentEvent>( output, "\n") );
48
49 return EXIT_SUCCESS;
50}
51
52void usage()
53{
54 cerr << "USAGE: dcconvertor <input file> <output file>" << endl;
55 exit( EXIT_FAILURE );
56}
57
Note: See TracBrowser for help on using the repository browser.