File names in a directory

This is a discussion on File names in a directory within the C++ Programming forums, part of the General Programming Boards category; I have the path and I need to get the name ofall files in the directory whos extention is *.___ ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    35

    File names in a directory

    I have the path and I need to get the name ofall files in the directory whos extention is *.___

    how might I go about doing this on both windows and *.nix?

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,203
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    35
    #include <dir.h> ?

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    To access a directory, and the files within it, is a very compiler/OS specific task. It's not practicable to show how to do this for all variations, so here are some examples for various compilers.
    Read.

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    Boost::filesystem might provide a way to do this that works on most platforms.

  6. #6
    Registered User
    Join Date
    May 2006
    Posts
    35
    Quote Originally Posted by Tonto
    Read.
    Thanks for an outstandingly worthless post. Save yourself the keystrokes next time.


  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,498
    I'm sure he would, if you ever bothered to read information posted, or bothered to contribute some actual information of what you've tried.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  3. Help Required!!!!!
    By bobthebullet990 in forum C Programming
    Replies: 14
    Last Post: 11-27-2005, 02:56 PM
  4. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM

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