Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_dos_findnext() find the next matching file</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _dos_findnext()         Find the next matching file

 #include   <dos.h>

  unsigned     _dos_findnext(buffer);
  struct find_t *buffer; Location of information returned by _dos_findfirst()

    _dos_findnext() uses MS-DOS function 4Fh to search for the next file
    that matches the most recent path, filename, and attributes used with
    _dos_findfirst().

    If a matching file is found, the information about that file is
    returned in struct find_t, declared in dos.h, having the following
    members:

               struct find_t {
                   char reserved[21];   Reserved for use by MS-DOS
                   char attrib;         File attribute byte
                   unsigned wr_time;    Time file last modified
                   unsigned wr_date;    Date file last modified
                   long size;           Length of file in bytes
                   char name[13];       Null terminated name and extension
                   }                    of file

    Returns:    If _dos_findnext() finds a matching file it returns 0,
                otherwise it returns the MS-DOS error code and sets errno
                to ENOENT. Normal attribute files are also returned when
                the specified attribute is _A_RDONLY, _A_HIDDEN,
                _A_SYSTEM, or _A_SUBDIR, even though none of these
                attributes are set.

      Notes:    If a matching file is found, the name and extension
                returned in find_t.name can be used to open the file.

                In MS-DOS 3.0 or higher, dosexterr() can be used for
                extended error code information.

   Portability:     MS-DOS only, version 2.0 or higher

------------------------------- Example ---------------------------------

 This program finds all files whose names start with "r" in the default
 directory, whether hidden or normal.

           #include <dos.h>

           main()
           {
              struct find_t file_info;
              unsigned notfound;

              notfound = _dos_findfirst( "r*.*", _A_HIDDEN | _A_NORMAL,
           &file_info);
              if (notfound)
                 printf("No files match %s\n", "r*.*");
              else
                 {
                 printf("The following files match %s:\n", "r*.*");
                 printf("\t%s\n", file_info.name);

                 while ( _dos_findnext( &file_info) == 0)
                 printf("\t%s\n", file_info.name);
                 }
           }


See Also: _dos_findfirst()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson