RE: [ROOT] Sorting the directory content

From: Philippe Canal (
Date: Tue Mar 30 2004 - 18:45:04 MEST


See the implementation of TChain::Add(const char *name, Int_t nentries)
for an example.

-----Original Message-----
[]On Behalf Of Raquel de los Reyes
Sent: Friday, March 26, 2004 10:53 AM
To: Roottalk
Subject: [ROOT] Sorting the directory content

Hi roorters,

    I have found in the Root Search web page, a small macro to list the
directory files:

  void *dirp = gSystem->OpenDirectory(directory);
  const char *afile;
  while(afile = gSystem->GetDirEntry(dirp)) {
      printf("file: %s\n",afile);

    My problem is that the showed list of files is not sorted
(equivalent Unix comand: "ls -f"), neither alphabetically nor
chronological order. How could I display the directory content in
alphabetical or chronogical order?.

    Thank you in advance.

    Regards:    Raquel

" Si fuera por el espacio
el Universo me rodearía y se me tragaría como a un átomo;
pero por el pensamiento, yo abrazo al mundo.	B. PASCAL"

Raquel de los Reyes López     		      	PhD student
Dpto. Física Atómica, Molecular y Nuclear	e-mail:
Universidad Complutense de Madrid (U.C.M.)	Telf.  +34-91-3944742
Avda. Complutense s/n  28040  Madrid (Spain)    Fax:   +34-91-3945193

This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET