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

This is a discussion on How can I get the filenames in a directory in standard environment? within the C Programming forums, part of the General Programming Boards category; Hi all! I want to get the list if the filenames in a specified directory. But I want it to ...

  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
    B26354 Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Use inclusion guards ;)
    Jason Deckard

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,548
    > 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, 07:50 PM
  4. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 01:54 AM
  5. Directory reading trouble
    By samGwilliam in forum Linux Programming
    Replies: 0
    Last Post: 03-10-2002, 08:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21