Atari ST series Technical Reference Manual page 133

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

GEMDOS File System Functions
)
Fsetdta (olddta);
/* if you're running this
add a pause to give the user a chance to read the output */
Cconws("\n\n\rPress any key to end");
Cconin();
)
/* end of main */
/ *
print e n t r y ()
{
2 0
char temp[
];
Cconws(dta.fname);
Cconws(blank+strlen(dta.fname)); /* pad to 12 spaces */
if(dta.attr==OxlO)
{
Cconws("<DIR>\r\n"); /* don't print size or date */
)
else
sprintf(temp,"%71d",dta.fsize);
Cconws(temp);
Ccon w s (" bytes
sprintf(temp,"%
dta.fdate&OxlF, (dta.fdate &0xlE0 )» 5,
(dta. f d a t e » 9 ) +1980) ;
Cconws(temp);
Cconws("
");
sprintf(temp,n%
(dta.ftime»ll)60xlF, (dta.ftime &0x 7E0)»5,
(dta.ftime&OxlF)*2);
Cconws(temp);
Cco n w s ("\r\n");
)
) /* end of print_entry() */
****************** end of GDIR.C ***********/
After compiling this program, you should rename it
GDIR.TTP to indicate that it may take parameters. To obtain
a specific directory listing, enter the directory name as the
parameter, including wildcard characters, like C:\PRO-
GRAMS\*.PRG. You may also run this program from within
the GPEXEC.TOS program described in Chapter 5. Once
GPEXEC prompts you for a command, enter it in the format:
GDIR.TTP A:Y\*
Directory Listings and Free Space Functions
One of the most common disk operations is obtaining a list­
ing of the directory contents. Since a disk may have
hundreds of files and subdirectories, it might be difficult set­
f r o m
the Desktop, you nay want to
format output for directory listings */
/* print file name
/* if this is a directory */
/ *
");
02
02
d/%
d/%d",
/* print file date */
02
02
02
d:%
d:%
d",
/* print file time
/* then restore DTA */
* /
else print file size
* /
* /
125

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents