FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DISK I/O

Get the volRefNum of a file knowing its resRefNum


There might not be a volRefNum% for this file, but you can find the details - then create a WD yourself. Something like this:

tnePointer& = @theParamBlock$
tnePointer&.ioCompletion& = 0
tnePointer&.ioFCBIndx% = 0
tnePointer&.ioVRefNum% = 0
tnePointer&.Iorefnum% = theResFile%
tnePointer&.ioNamePtr& = @gTheResFile$
osErr% = FN GETFCBINFO (tnePointer&)

Jamin


The two numbers are not related. My guess is that you're trying to get a working directory ref. number for the folder which contains the resource file. Does that sound right? You can get information about the file, based on its resRefNum%, by calling FN GETFCBINFO, as in this demo:

'=============================================
LOCAL FN WhichFile(theRefNum)
DIM pb.62, 31 filename$
pb.ioNamePtr& = @filename$
pb.ioRefNum% = theRefNum
pb.ioFCBindx& = 0
OSErr = FN GETFCBINFO(@pb)
CLS
LONG IF OSErr
PRINT "OSErr = "; OSErr
XELSE
PRINT "Volume = "; pb.ioFCBVRefNum%
PRINT "Parent Dir ID = "; pb.ioFCBParID&
PRINT "File name = "; filename$
INPUT x
END IF
END FN

f$ = FILES$(_fOpen,,,v)
LONG IF LEN(f$)
oldRef = FN CURRESFILE
r = FN OPENRFPERM(f$, v, _fsRdPerm)
LONG IF r <> -1
FN WhichFile(r)
IF r <> oldRef THEN CALL CLOSERESFILE(r)
END IF
END IF
'=============================================

Once you've got the volume number (ioFCBVRefNum) and the file's parent directory ID (ioFCBParID), you can use those to generate a working directory reference number--if you _really_ want to do that. It's easy enough to work in FB without using working directory ref. numbers, and they are "disrecommended" by Apple.

Rick