Searching for Directories?

This is a discussion on Searching for Directories? within the C++ Programming forums, part of the General Programming Boards category; Hey, I know how to search for files using findfirst() and findnext(). But that only works for files. How can ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    1

    Question Searching for Directories?

    Hey,
    I know how to search for files using findfirst() and findnext(). But that only works for files. How can I search for Directories using C++? I would be grateful to anybody who can help me out on this one.

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Check out this page .

    You need to use FindFirstFile() and FindNextFile() and you can figure out if it's a directory like this :
    Code:
    if( win32FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) //not extension
    {
      // directory
    }
    Last edited by laasunde; 07-29-2003 at 10:04 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 05:20 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Visual C++ 2005 linking and file sizes
    By Rune Hunter in forum C++ Programming
    Replies: 2
    Last Post: 11-12-2005, 09:41 PM
  4. Searching and matching strings: segmentation fault
    By Smola in forum C Programming
    Replies: 18
    Last Post: 07-11-2005, 12:25 AM

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