Thread: subdirectories

  1. #1
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369

    subdirectories

    Is there any way to find what subdirectories a directory has?
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    this is OS/Compiler specific.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    XP/MSVC++
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  4. #4
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    the typical way is findfirst() findnext().

    _findfirst():

    http://msdn.microsoft.com/library/de...ndfirsti64.asp

    _findnext():

    http://msdn.microsoft.com/library/de...indfirsti64asp

    _finddata_t + example of use:

    http://msdn.microsoft.com/library/de..._functions.asp

    BTW: it doesnt use the _A_SUBDIR flag, but it shouldn't be to hard from here.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  5. #5
    Registered User
    Join Date
    Dec 2002
    Posts
    119
    Use FindFirstFile
    Code:
    HANDLE hSearch;
    WIN32_FIND_DATA  fd;
    hSearch = FindFirstFile("C:\\", &fd);
    Then use FindNextFile to loop & continue searching the current directory
    Code:
    FindNextFile(hSearch, &fd);
    Each time, examine the fd struct
    if(fd->dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
    then it's a directory

    -Futura

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another makefile question
    By chacham15 in forum Tech Board
    Replies: 0
    Last Post: 10-24-2008, 12:47 PM