EasyManua.ls Logo

Atari ST series - Page 132

Atari ST series
420 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CHAPTER 6
The Ddelete() function is used to remove a subdirectory:
int status;
char ^pathname;
status = Ddelete(pathname);
where pathname points to a null-terminated ASCII string
which contains the path name of the directory to delete. If
GEMDOS is able to delete the directory, a 0 is returned in
status, otherwise, a negative GEMDOS error number is reî™…
turned. Note that a subdirectory may only be deleted if it is
empty.
Program 6-2 below demonstrates the entire process for
obtaining a directory listing in C.
Program 6-2. GDIR.C
/**********************************************/
/* */
/* GDIR.C— Demonstrates how to get a * /
/* directory listing using GEMDOS */
/* file functions. */
/* */
/**********************************************/
#include <osbind.h> /* For GEMDOS macro definitions */
struct diskbufr /* data structure for DTA * /
(
char resvd[2 1];
char attr;
int ftime;
int fdate;
long fsize;
char fname[14];
} dta;
char blank[13]=" /* 12 spaces— for name padding */
main(argc,argv)
int argc; /* number of command arguments */
char *argv[]; /* array of pointers to command strings */
{
struct diskbufr *olddta;
char *temp;
if (argc>2) /* if more than one command argument */
{
Cconws("Too many arguments\r\n");
exit(O); / * complain and quit */
}
if (argc==2)
temp=argv[1]; / * if only one argument, use it */
else temp = "*.*"? /* or default to * /
olddta = (struct diskbufr *)Fgetdta(); /* save old DTA */
Fsetdta (&dta); /* and use new DTA */
if (Fsfirstftemp,0x10)) /* get first file * /
puts ("File(s) not found");
else
(
print_entry(); /* and print entries.. */
whilef!Fsnext()) /* until done */
print_entry();
124

Related product manuals