qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
FindFirst Procedure
  Summary Details Example                                   Back
 
  Arguments
 
    pathname     String expression representing the pattern sought
 
    attribute    Word expression representing the attribute
                 specification
 
    result       Record variable of type SearchRec
 
  Description
 
    The FindFirst procedure looks for the first occurrence of a file
    matching a given pattern and attributes. If pathname contains a
    directory name, FindFirst searches in the given directory.
    Otherwise, it searches the current directory. FindFirst fills a
    record of type SearchRec with the results of the search. The
    record may be passed to FindNext.
 
    The pathname argument is a string containing a pattern for a file
    name. The name may include DOS wild card characters; namely, the
    question mark (?) and asterisk (*). It may include a directory
    specification, which may be specified with the DOS shorthand
    directory notation '.' and '..'. The argument is of type PathStr,
    defined in the Dos unit.
 
    The attribute argument passes the attribute specification for the
    search. To specify an attribute, pass one or more values. The Dos
    unit defines the possible attribute values as constants.
 
    To search for a normal file, specify the constant Archive. To search
    for a file regardless of attribute, specify AnyFile.
 
    Pass more than one file attribute to FindFirst by using the
    predefined constants, the plus operator (+), and AND, OR, and NOT.
    For example, to search for files with both the read-only and the
    archive bits set:
 
       FindFirst( pathname, ReadOnly+Archive, result );
 
    The result argument is a record of type SearchRec, defined in the
    Dos unit. FindFirst returns the result of the search in the
    SearchRec record.
 
    Use FindFirst together with FindNext to find all occurrences of
    files matching a specified pattern and attribute.
 
    FindFirst reports error conditions in DosError, defined in the Dos
    unit. Possible error values are 2, "file not found," and 18,
    "no files."