Atari ST series Technical Reference Manual page 134

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

ting up one big buffer to get all of the names at once. There­
fore, GEMDOS uses a system by which you set up a buffer
large enough to hold only the information for a single file, and
then proceed to read the directory information a file at a time.
The first step is to set the Disk Transfer Address (DTA)
that points to the buffer used for disk read operations. This
buffer is used as a scratch area for directory searches. To set
the buffer, use the Fsetdta() function:
char dta[44];
Fsetdta(dta);
where dta is a pointer to the Disk Transfer Address buffer
that will be used from now on. You may wish to save the
default DTA, and restore it when you're finished. To find the
current DTA before setting your own, use the Fgetdta()
function
char *dta;
dta = Fgetdta( );
which returns a pointer to the current Disk Transfer Address
buffer in dta.
The next step in obtaining a directory listing is to per­
form a search for the first file on the list. When asking for a
directory listing, you may specify the file attributes of files to
be searched for, as well as names and/or extensions. The
Fsfirst() function used for this purpose is called in the fol­
lowing manner:
int status, attributes;
char *filespec;
status = Fsfirst(filespec, attribs);
where filespec points to a null-terminated ASCII string con­
taining the file specification to be searched for. Since wild­
cards may be used in a file specification, it may refer to a sin­
gle file (for example, C:\MYPROG.PRG), a class of files (for
example, *.BAS), or any file at all (for example, *.*). The attri­
butes argument specifies the types of files for which to
search. As you've seen above, file types include read-only,
system, hidden, volume name, and directory. When a partic­
ular bit of the attributes flag is set, the directory search only
includes files with that attribute. The various attribute bits
are shown in Table 6-5.
CHAPTER 6

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents