Amos Professional Manual  Contents  Index

Disc Access


DIR FIRST$
function: get first file that satisfies current path name
file$=Dir First$(path$)

This function returns a string containing the name and the length of the first file on the current disc that matches up with your chosen search path. For example, the next routine reports the first file or folder in the current directory, followed by the first IFF file in the directory. Obviously, this could be the same file.

E> Print Dir First$("*.*")
   Print Dir First$("*.IFF")

When DIR FIRST$ is used, the whole directory listing is loaded into memory, so you can continue to discover the name of the next file in the current directory with the following function.

DIR NEXT$
function: get next file that satisfies current path
file$=Dir Next$

Use this to return the filename that comes after the file or folder found by the previous DIR FIRST$ search. If there are no more files to come, an empty string will be returned, "". Once the last filename has been found, AMOS Professional will automatically grab back the memory used by the directory array, and release it for the rest of your program to use. The next example prints every file in the current directory.

E> F$=Dir First$("*.*")
   While F$<>""
    Print F$ : Wait 50
    F$=Dir Next$
   Wend

Selecting a file

FSEL$
function: select a file
f$=Fsel$(path$)
f$=Fsel$(path$,default$,title1$,title2$)

This file selection function allows you to choose the files you need directly from a disc, using the standard AMOS Professional file selector. In its simplest form, it operates like this:

D> Print Fsel$("*.IFF")

The string held within the brackets is a path that sets the searching pattern, in that case an IFF file. The following optional parameters may also be included:

The optional default string is used to choose a filename that will be automatically selected if you press [Return] and abort the process.

Back    Next
10.02.07