Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>findfirst() search disk directory</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 findfirst()             Search Disk Directory

 #include   <dir.h>

 int          findfirst(pathname,ffblk,attrib);
 const char   *pathname;                 Name of file to be found
 struct ffblk *ffblk;                    File directory information
 int          attrib;                    Attribute word

    findfirst() uses MS-DOS system call 0x4E to search a disk directory
    for the file associated with 'pathname'.  'pathname' is a string
    consisting of a drive specifier (optional), a path name (optional),
    and a file name, which can include the wildcard characters ? and *.
    If the file is found, the MS-DOS DTA (disk-transfer address) is set
    to the 'ffblk' address and the 'ffblk' structure is filled with file-
    directory information as follows:

          struct ffblk  {
                    char ff_reserved[21];         /* Reserved by DOS */
                    char ff_attrib;                    /* Attribute found */
                    int ff_ftime;                 /* File time */
                    int ff_fdate;                 /* File date */
                    long ff_fsize;                /* File size */
                    char ff_name[13];             /* Found file name */
          };

    'attrib' is used in selecting eligible files for the search. 'attrib'
    can be one of the following constants (defined in <dos.h>):

                FA_RDONLY     Read only attribute
                FA_HIDDEN     Hidden file
                FA_SYSTEM     System file
                FA_LABEL Volume label
                FA_DIREC Directory
                FA_ARCH       Archive

       Returns:     0, if successful. On error, or if no matching file is
                    found, -1 is returned and 'errno' (defined in
                    <errno.h>) is set to ENOENT (Path or file name not
                    found) or ENMFILE (No more files).

   Portability:     MS-DOS only.


See Also: findnext()

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