Hi,
You must call in the order:
void *dir = gSystem->OpenDirectory("mydir");
then in a loop you call
const char *filename = gSystem->GetDirEntry(dir);
until filename=0
Rene Brun
On Mon, 18 Nov 2002, Stanley Forrester wrote:
> In the following script
>
> gROOT->Reset();
>
> GetDirEntryExample(){
>
> // Line to demonstrate that gSystem-> works.
> gSystem->Exec("ls *2.C");
>
> char * fName[256];
>
> // get a file name from pwd.
> fName = gSystem->GetDirEntry("./");
> cout << "The first file name is " << & fName << " 1 " << endl;
>
> }
>
> gives the result
>
> root [6] .L GetDirEntryExample.C
> root [7] GetDirEntryExample()
> HistoComp2.C HistoCompairison2.C
> The first file name is (nil) 1
> (int)1085959104
> root [8]
>
> Why do I get nil instead of string with the first file name in the
> directory and what does (int)1085959104 signify?
>
>
> --
> ---------------------------------------------------
> | Stanley S Forrester Office: B0 Trailers 139-C |
> | UC Davis Email: sforrest@fnal.gov |
> | CDF MS 318 Fermilab Phone: (630) 840 2388 |
> | PO Box 500 Fax: (630) 840 2968 |
> | Batavia, IL 60510 |
> ---------------------------------------------------
>
> "We know finite disappointment, but we know
> infinite hope" - Martin Luther King.
>
> I thought this appropriate on the day after the
> republican electorial victory. ssf
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:18 MET