/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/EXAMPLE/addRandomAccess.cc File Reference

#include "lcio.h"
#include "IO/LCWriter.h"
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>

Include dependency graph for addRandomAccess.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Variables

static std::vector< std::string > FILEN


Function Documentation

int main ( int  argc,
char **  argv 
)

Simple program that opens existing LCIO files and appends the records needed for direct access - if they don't exist.

Definition at line 19 of file addRandomAccess.cc.

00019                                 {
00020   
00021     
00022     // create sio writer
00023     LCWriter* lcWrt = LCFactory::getInstance()->createLCWriter()  ;
00024 
00025     // read file names from command line (only argument) 
00026     if( argc < 2) {
00027       std::cout << " usage:  addRandomAccess <input-file1> [[input-file2],...]" << std::endl ;
00028       exit(1) ;
00029     }
00030     for(int i=1 ; i < argc ; i++){
00031       FILEN.push_back( argv[i] )  ;
00032     }
00033 
00034     int nFiles = argc-1 ;
00035 
00036     for( int i=0 ; i <nFiles ; ++i ) {
00037 
00038       try{
00039       
00040         lcWrt->open( FILEN[i] , LCIO::WRITE_APPEND )  ;
00041 
00042         lcWrt->close() ;
00043 
00044       }catch(IOException& e){
00045 
00046         std::cout << " io error in file  " << FILEN[i] << " : " << e.what() << std::endl ;
00047       }
00048     }
00049 
00050     return 0 ;
00051 }


Variable Documentation

std::vector<std::string> FILEN [static]

Definition at line 13 of file addRandomAccess.cc.

Referenced by main().


Generated on Mon Jan 7 13:16:40 2013 for MicromegasFramework by  doxygen 1.4.7