[ROOT] Using an array of strings

From: Stilianos Kesisoglou (kesisogl@fnal.gov)
Date: Wed Aug 28 2002 - 00:12:45 MEST


Hi,

    I am having a problem with the following simple piece of code:

1:   #include <fstream>
2:   #include <cstring>
3:   #include "TFile.h"
4:
5:   ifstream fin("LIST");
6:   
7:   int test()
8:   {
9:       char input[17][];       
10:       for (int idx=0; idx<17; idx++)
11:       {
12:           fin >> input[idx];           
13:           cout << input[idx] << endl;
14:                       
15:           TFile *f = new TFile(input[idx],"read");
16:                   .   
17:                   .   (my code here)
18:                   .
19:           f->Close();             
20:       }  
21:   } 

    My intention is to read from a file named "LIST", a list of filenames and then
open them in sequence, run my code and close them.

    Although I can see from the print-out (line 13), that the variable "input[idx]" holds my filename,
the attempt to open the file fails (line 15).

    Can anyone help me?

    Thanks !

Stelios.



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:06 MET