Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileFSFIRST(p$,attr) FSNEXT() p$: sexp attr: iexp The function FSFIRST() searches for the first file on a disk to fulfill the criteria specified in p$ (e.g. "C:\*.GFA"). If such a file is found, the file name, together with other information, is written into the DTA (see FGETDTA() and FSETDTA()). The parameter attr contains the file attributes which the file to be found may have; for instance, it is possible to search for hidden files (bit 1) or folders (bit 4). The function FSNEXT() searches for the next file which fulfills the conditions of FSFIRST(). The meaning of the attribute bits: Bit Meaning (if the bit is =1) 0 The file is write protected 1 The file is hidden (excluded from DIR search) 2 The file is a System file (excluded from DIR search) 3 Disk label 4 Folder (sub-directory) 5 Archive bit Example: ~FSETDTA(BASEPAGE+128) !Set the DTA e%=FSFIRST("\*.GFA",-1) !Set search criteria (-1 = all bits set) DO UNTIL e% IF BYTE{BASEPAGE+149} AND 16 !If it is a folder PRINT "*";CHAR{BASEPAGE+158}, !indicate by a star ELSE !otherwise PRINT 'CHAR{BASEPAGE+158}, !a space before the file name ENDIF e%=FSNEXT() !Continue search LOOP --> Displays all files with the extension .GFA from the current directory on the screen, as well as all folder names with that extension, indicated with the prefix '*'. Memo: This will fail: e%=FSFIRST(p$,attr&) DO UNTIL e% f$=CHAR{BASEPAGE+128+30} IF EXIST(f$) ' EXIST() calls FSFIRST() internally and breaks the search criteria! ENDIF e%=FSNEXT() LOOP Fsfirst()+, Fsnext()+