[ROOT] problem with TString's and char's

From: Daniela Kaefer (kaefer@physik.rwth-aachen.de)
Date: Fri Nov 28 2003 - 03:56:00 MET


Hello, 

I want to fill .root-files in a certain directory into a filelist. I used to do 
this with char, but now "completepath" has to be of type TString... Can anybody 
help me, please?  I do not need basename, dirhandle or fullname any further, 
just completepath. Thanks for any tipp.

  const Text_t *basename;
  TList  *filelist = new TList;
  while ((basename = gSystem->GetDirEntry(dirhandle))) {
    // skip non-root files
    //--------------------
    if (!strstr(basename, ".root")) continue;
    Text_t *fullname = new 
Text_t[strlen((Char_t)completepath)+strlen(basename)+2];
    strcpy(fullname, (Char_t)completepath);
    strcat(fullname, "/");
    strcat(fullname, basename);

    // fill root-file names into <filelist>
    //-------------------------------------
    filelist->Add(new TObjString(fullname));
    rootfiles++;
    delete fullname;
  }


Cheers, Daniela

 +------------------------------------------------------------+
 | Daniela Kaefer       | email: kaefer@physik.rwth-aachen.de |
 | III. Phys.Institut A |        kaefer@fnal.gov     \_L_/    |
 | Physikzentrum        |                            /* *\/   |
 | 52056 Aachen         | work: +49-(0)241-80-27243  \_*_/\   |
 | Germany              | home: +49-(0)2472-7163     / | \    |
 +------------------------------------------------------------+



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET