Thread: How can I get the filenames in a directory in standard environment?

  1. #1
    Unregistered
    Guest

    Question How can I get the filenames in a directory in standard environment?

    Hi all!

    I want to get the list if the filenames in a specified directory. But I want it to work under UNIX and DOS too. How can I do this? Is there a common solution for this problem? Thanks

  2. #2
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Use inclusion guards ;)
    Jason Deckard

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > Is there a common solution for this problem?
    Not between UNIX and DOS there isn't

    So you need to use conditional compilation to read directories in an OS specific fashion

    If you restricted yourself to POSIX compliant operating systems (unix, linux, windows NT/2K, and some others), then dirent.h would be a standard feature

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to tell if a file or directory
    By swappo in forum C++ Programming
    Replies: 4
    Last Post: 07-07-2009, 10:57 AM
  2. Bug in iterator comparison in C++ standard?
    By steev in forum C++ Programming
    Replies: 14
    Last Post: 07-12-2008, 12:02 AM
  3. Replies: 8
    Last Post: 03-08-2008, 08:50 PM
  4. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 02:54 AM
  5. Directory reading trouble
    By samGwilliam in forum Linux Programming
    Replies: 0
    Last Post: 03-10-2002, 09:43 AM