Int 21H [2.0] Function 4FH (79) Find next file

Assuming a previous successful call to Int 21H Function 4EH, finds the next file in the default or specified directory on the default or specified drive that matches the original file specification.

Call with:

AH = 4FH

Assumes DTA points to working buffer used by previous successful Int 21H Function 4EH or 4FH.

Returns:

If function successful (matching file found)

Carry flag = clear

and search results returned in current disk transfer area as described for Int 21H Function 4EH

If function unsuccessful (no more matching files)

Carry flag = set

AX = error code

Notes:

Use of this call assumes that the original file specification passed to Int 21H Function 4EH contained one or more * or ? wildcard characters.

When this function is called, the current disk transfer area (DTA) must contain information from a previous successful call to Int 21H Function 4EH or 4FH.

Example:

Continuing the search operation in the example for Int 21H Function 4EH, find the next .COM file (if any) in the directory \MYDIR on drive C.

fname db 'C:\MYDIR\*.COM',0

dbuff db 43 dup (0) ; receives search results

.

.

.

; search for next match

mov ah,4fh ; function number

int 21h ; transfer to MS-DOS

jc error ; jump if no more files

.

.

.