Fork me on GitHub

Changeset 274 in svn


Ignore:
Timestamp:
Feb 16, 2009, 1:16:39 PM (16 years ago)
Author:
Xavier Rouby
Message:

memory leak free

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Examples/Trigger_Only.cpp

    r264 r274  
    5050using namespace std;
    5151
    52 //------------------------------------------------------------------------------
    53 void todo(string filename) {
    54   ifstream infile(filename.c_str());
    55   cout << "** TODO list ..." << endl;
    56   while(infile.good()) {
    57         string temp;
    58         getline(infile,temp);
    59         cout << "*" << temp << endl;
    60   }
    61   cout << "** done...\n";
    62 }
    63 
    64 //------------------------------------------------------------------------------
    65 
    6652int main(int argc, char *argv[])
    6753{
    6854  int appargc = 2;
    69   char *appName = "Trigger_Only";
    70   char *appargv[] = {appName, "-b"};
     55  char *appName= new char[20];
     56  char *appOpt= new char[20];
     57  sprintf(appName,"Trigger_Only");
     58  sprintf(appOpt,"-b");
     59  char *appargv[] = {appName,appOpt};
    7160  TApplication app(appName, &appargc, appargv);
    72 
     61  delete [] appName;
     62  delete [] appOpt;
     63 
    7364  if(argc != 2 && argc !=3 ) {
    7465      cout << " Usage: " << argv[0] << " input_file output_file [detector_card] [trigger_card] " << endl;
     
    9485
    9586  //read the datacard input file
    96   string TrigDatacard("data/trigger.dat");
     87  string TrigDatacard("");
    9788  if(argc==3)  TrigDatacard =argv[2];
    9889
Note: See TracChangeset for help on using the changeset viewer.