[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   Function:   FindFirst()

               The FindFirst function seeks the first file matching
               a certain file mask. It requires a preinitialised variable
               of 43 bytes (The DTA: Disk Transfer Adres), which holds some
               results needed by subsequent FindNext()'s. It also holds
               the name and other attributes of the file found.
               the DTA thus has to be submitted by reference, this is
               quite important, and illustrated in the examples.

   Syntax:     FindFirst(<cMask>,<nAttr>,@<DTA>) --> nCode

   Arguments:  <cMask> is a Mask of the files to search for. '*.*'
               indicates all files in current directory. Directory and
               drive designators may be used. <nAttr> indicates the sort of
               files to look for. See later. @<DTA> is a 43 bytes variable
               that is filled with Information. Note that it is passsed
               by reference!

   Returns:    <nCode> is a DOS error code:
                    0 - Okay, found a matching file.
                    2 - File not found
                    3 - Directory not found.
                   18 - No more matching files.

   Usage:      See EXPDEMO.PRG.

               * - List directories:
               DTA := Space(43)
               x := FindFirst('*.*',16,@DTA)

               /* skip over Dots */
               while (x=0) .and. (FindName(DTA)='..' .or. FindName(DTA)='.')
                    x := FindNext(@DTA)
               end

               while (x=0)
                    if findAttr(DTA) = 16
                        ? FindName(DTA)     /* and/or Date time evt. */
                    end
                    x := FindNext(@DTA)
               end

See Also: FindNext() FindName() FindSize() FindAttr() FindDate()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson