Introduction | Language Structure | IB Statements | File System | Comet 32 Runtime | Index |
| Mnemonic: | (FindNextFile=flags) | ||||||||||||||||||||||||||||||||||||||||||||||
| Discussion: |
This mnemonic finds the next file (in ASCII order) in a Windows folder.
This mnemonic may be used by foreground programs only. This mnemonic is issued after the (FindFirstFile) mnemonic or after the (FindNextFile) mnemonic Example: The (FindFirstFile) mnemonic can be used to find the first file matching a certain wild card value, then the (FindNextFile) can be used, repeatedly, to find subsequent files matching the same wild card value. Flags is the sum of the specified decimal values from the following chart:
After this mnemonic is issued, your program can issue an INPUT on LUN (0) to retrieve the file and error information. For example:
LENGTH 2 & LOCAL AX$,DX$
LENGTH 254 & LOCAL RESULT$
ResultFmt: FORMAT AX$;DX$;RESULT$
.
.
Print (FindNextFile=Flags)
Input (0,ResultFmt)
! The file name starts at position 45
Result$ = Sub(Result$, 45, 254)
! Find length of strng
Delim = Pos("@00@", Result$)
If (Delim NE 0) Then _
Result$ = Sub(Result$, 1, Delim-1)
Print "Filename:";Result$
The file name starts at position 45 of the RESULT$ field.
This mnemonic also returns two error fields. The first of these, AX$, contains the function error code, and the second one, DX$, contains the suberror code (aka the Windows file error code). Both of these fields are in Intel 2's complement format, and should be processed as follows: AX$ = SUB(AX$,2,1) + SUB(AX$,1,1) ! Flip the bytes around DX$ = SUB(DX$,2,1) + SUB(DX$,1,1) ! Flip the bytes around FuncError = HexDec(AX$) ! Function error code (decimal) FileError = HexDec(DX$) ! File error code (decimal) ! For unexpected values, convert to 2's complement signed integer If (FuncError > 32767) FuncError = FuncError-65536 If (FileError > 32767) FileError = FileError-65536Here is a list of the function error codes in decimal form:
Here is a list of the suberror codes (common Windows file errors) in decimal form:
| ||||||||||||||||||||||||||||||||||||||||||||||
| History: | This mnemonic was added in Comet Build 299 and REL Version 01.07. |