Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>_dos_findfirst</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
_dos_findfirst
==============

Syntax
------

     #include <dos.h>
     
     unsigned int _dos_findfirst(char *name, unsigned int attr, struct find_t *result);

Description
-----------

This function and the related `_dos_findnext' (_dos_findnext:.)   
are used to scan directories for the list of files therein. The NAME is
a wildcard that specifies the directory and files to search. RESULT is
a structure to hold the results and state of the search, and ATTR is a
combination of the following:

`_A_NORMAL (0x00)'
     Normal file (no read/write restrictions)

`_A_RDONLY (0x01)'
     Read only file

`_A_HIDDEN (0x02)'
     Hidden file

`_A_SYSTEM (0x04)'
     System file

`_A_VOLID (0x08)'
     Volume ID file

`_A_SUBDIR (0x10)'
     Subdirectory

`_A_ARCH (0x20)'
     Archive file

_dos_findnext:.   

Return Value
------------

Zero if a match is found, DOS error code if not found (and sets ERRNO).

Example
-------

     struct find_t f;
     
     if ( !_dos_findfirst("*.DAT", &result, _A_ARCH | _A_RDONLY) )
     {
       do
       {
         printf("%-14s %10u %02u:%02u:%02u %02u/%02u/%04u\n",
                f.name,
                f.size,
                (f.wr_time >> 11) & 0x1f,
                (f.wr_time >>  5) & 0x3f,
                (f.wr_time & 0x1f) * 2,
                (f.wr_date >>  5) & 0x0f,
                (f.wr_date & 0x1f),
                ((f.wr_date >> 9) & 0x7f) + 1980,
       } while( !_dos_findnext(&f) );
     }


See Also: _dos_findnext _dos_findnext

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