[futurebasic] Re: [FB] FLOPPY DISK

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2000 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Sun, 16 Jul 2000 09:16:22 -0500
JSMITHXX@... wrote:
> 
> Want to know the name & volume ref number of the floppy drive/disk.
> Outside of looking at all volumes at the root level and selecting
> the one with available space of less than 1.4 megs, is there a more
> elegant way of doing it ??

Every drive has a drive number, which you can use in place of a volume ref.
number when you specifically want to reference the volume in that drive.  (The
MacOS can tell whether you're specifying a drive number or a volume ref.
number because drive numbers are always positive and volume ref. numbers are
always negative.)

In all cases that I know of, the drive number for the floppy drive is always 1
(I just checked on my G3 and this is the case there).  Therefore, you should
be able to access the floppy drive by specifying "1" as the volRefNum
parameter.  This works in Toolbox calls as well as in things like FB's OPEN statement.

Specifying volRefNum=1 will get you to the ROOT directory of the floppy; if
you want to get to a deeper folder in the floppy, you can specify a relative
pathname beginning with a colon as your "filename" parameter.

To test this, I created a folder called "test folder" on a floppy, then ran
the following code:

driveNum = 1  'The floppy drive
relPath$ = ":test folder:myfile" 'relative path must begin w/colon
DEF OPEN "TEXT"
OPEN "O", #1, relPath$, , driveNum
PRINT#1, "This is a test"
CLOSE #1

This worked fine: i.e., it created a new file called "myfile" inside the "test
folder" directory on the floppy.

Hope this helps.
- Rick