home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / dtx9303 / ms_c_7 / hotline / ff.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-04  |  1.1 KB  |  46 lines

  1. // =========================================================
  2. //                FILEFIND.CPP
  3. //              FileFind-Routine
  4. // =========================================================
  5.  
  6. #include <dos.h>
  7. #include <stdio.h>
  8. #include <direct.h>
  9.  
  10. void FindFile(const char * pszFileName );
  11. void main(void)
  12. {
  13.    FindFile( "*.*" );
  14. }
  15.  
  16. void FindFile(const char * pszFileName)
  17. {
  18.    struct find_t aFile;
  19.    int fDone;
  20.    fDone = _dos_findfirst(pszFileName, 0xffff, &aFile);
  21.    while (! fDone)
  22.    {
  23.       if (((aFile.attrib&_A_SUBDIR) != _A_SUBDIR) &&
  24.          (aFile.name[0] != '.') &&
  25.          ((aFile.attrib&_A_VOLID) != _A_VOLID))
  26.       {
  27.          printf("%s\n", aFile.name );
  28.       }
  29.       fDone = _dos_findnext(&aFile);
  30.    }
  31.    fDone = _dos_findfirst("*", _A_SUBDIR |
  32.            _A_SYSTEM | _A_HIDDEN, &aFile);
  33.    while (! fDone)
  34.    {
  35.       if (((aFile.attrib&_A_SUBDIR) == _A_SUBDIR) &&
  36.          (aFile.name[0] != '.'))
  37.          {
  38.             printf("sub:%s\n", aFile.name);
  39.             chdir(aFile.name);
  40.             FindFile(pszFileName);
  41.             chdir("..");
  42.          }
  43.          fDone = _dos_findnext(&aFile);
  44.    }
  45. }
  46.