[comp.sys.atari.st] <<WARNING to DESK ACC Creators>>

kens@atari.UUCP (Kenneth Soohoo) (08/02/89)

TO ANYONE DEVELOPING DESK ACCESSORIES:

Don't use Fsfirst()/Fsnext() without first setting the DTA to your own local
buffer area using Fgetdta() and Fsetdta()!!!!!!!!

If you're a Desk Acc, you'll be overwriting the desktop's DTA, and you
never know what that can do to your desktop...

Now, once you're done with your Fsfirst() and Fsnext()ing, be sure to
restore the DTA to it's old value!!! That _too_ can cause problems...

SAMPLE CODE:
(Using MWC 3.0.6 Bindings. In some compilers "DMABUFFER" is "DTA".
 In any case, it's a 44 byte buffer that contains usefull info about
 file searches.)

	int 		err;
	DMABUFFER	*oldbuff, newbuff;

	oldbuff = Fgetdta();		/* Save old DTA for later */
	Fsetdta(&newbuff);		/* Tell GEMDOS about OUR buff */

	/*	
		Insert Fsfirst() and Fsnext() calls here...

		err = Fsfirst("*.*", 0);	/* First DTA fill */
		while (err == E_OK) {
			/* Process DTA */
			err = Fsnext();		/* Fill DTA again */
			}
	*/

	Fsetdta(oldbuff);		/* Restore for desktop's use */


Hope this helps...

-- 
Ken Soohoo			{ames,imagen,portal}!atari!kens
Atari (U.S.) Engineering
>> The Opinions Expressed above are _MINE_, _NOT_ Atari's. <<