ScriptBasic:UsersGuide 12.14

From ScriptBasic
Jump to: navigation, search

[Contents]

12. File Handling

12.14. Listing files

[<<<] [>>>]

12.14.1. Open directory
12.14.2. Function NextFile
12.14.3. Function EOD
12.14.4. Reset directory
12.14.5. Close directory

Up to know we have discussed instructions and operations that were dealing with files. To access a file you needed to know the name of the file. Many times the program does not know the file and needs to get the list of all files in a certain directory. To do this you can use the commands OPEN DIRECTORY, CLOSE DIRECTORY and the function NextFile.The command OPEN DIRECTORY opens a directory for getting the list of the file. The command reads the list of the files and creates an internal list of the files.The function NextFile can be used to retrieve the files of the directory opened one by one. When the last file name has been retrieved or when there is no need to retrieve the remaining file names the command CLOSE DIRECTORY should be used to close the listing.


[<<<] [>>>]