[ace-users] ACE_DIRENT question

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Wed Aug 1 02:12:53 CDT 2007


Hi Stew,

To ensure that we have proper version/platform/compiler information,
please make sure you fill out the appropriate problem report form (PRF),
which is in

$ACE_ROOT/PROBLEM-REPORT-FORM
$TAO_ROOT/PROBLEM-REPORT-FORM

or in

$ACE_ROOT/BUG-REPORT-FORM
$TAO_ROOT/BUG-REPORT-FORM

in older versions of ACE+TAO.  Make sure to include this information
when asking any questions about ACE+TAO since otherwise we have to
"guess" what version/platform/compiler/options you've using, which is
very error-prone and slows down our responsiveness.  If you don't use
the PRF, therefore, it is less likely that someone from the core
ACE+TAO developer team will be able to answer your question.
Naturally, we encourage and appreciate other members of the ACE+TAO
user community who can respond to questions that they have the answers
to.

> I need to generate a list of all the files in a directory. I'm looking
> at the ACE_Dirent_Selector class... specifically the open command and
> the ACE_DIRENT structure.  I looked at the definition for ACE_DIRENT
> in ace/os_include/os_dirent.h, and found the following structure:
> 
> struct dirent {
>   unsigned short d_ino;
>   unsigned short d_off;
>   unsigned short d_reclen;
>   // This must be a ACE_TCHAR * and not a one element
>   // ACE_TCHAR array.  It causes problems on wide
>   // character builds with Visual C++ 6.0.
>   ACE_TCHAR *d_name;
> };
> 
> followed by:
> 
> #define ACE_DIRENT dirent
> 
> This structure is only defined in builds where ACE_LACKS_STRUCT_DIR is
> defined. Being unfamiliar with dirent structure on POSIX systems, I'm
> wondering if the ACE_DIRENT structure members are guaranteed to be the
> same across all platforms? 

Yes.

> Also, is there a class for extracting these values in an OO manner, or
> is it standard practice to operate on the structure?

It's standard practice to operate on the structure.  Please see 

ACE_ROOT/tests/Dirent_Test.cpp

for details.

Thanks,

     Doug



More information about the Ace-users mailing list