On 11/17/98 at 7:43 PM, Sylvain wrote:
:Would someone give it a try ? (i'm on my knees now...)
:I'd really appreciate, coz i absolutely need this function.
:
:Thanks.
:
:Sylvain
:--------------------------------------------------
:FUNCTION GetVolRefNum (PathName : str255; VAR VRefNum : integer) : OSErr;
:
: (* given a path name of volume name, returns its VRefNum *)
:
: VAR
: ThePBRec : paramBlockRec;
: TheErr : OSErr;
:
: BEGIN
: IF POS(':',PathName) = 0
: THEN PathName := CONCAT(PathName,':');
:
: WITH ThePBRec DO
: BEGIN
: ioVolIndex := -1;
: ioVRefNum := 0;
: ionamePtr := @PathName;
: END;
:
: TheErr := PBGetVInfoSync(@ThePBRec);
:
: VRefNum := ThePBRec.ioVRefNum;
:
: GetVolRefNum := TheErr;
: END; {GetVolRefNum}
BTW, this is a Pascal variant; not C!
LOCAL FN GetVolRefNum (PathName$, @VRefNum&)
REM given a path name of volume name, returns its volume ref num
REM call like this :
REM
REM err = FN GetVolRefNum(thePath$,theVol%)
REM
REM NOTE: a volume ref num is NOT the same as a working directory reference
number,
REM which is what FutureBasic really uses when it refers to a "vRefNum%"
REM - a volume ref num refers to the actual volume itself; not a directory or
folder.
DIM ThePBRec.80
DIM OSErr
IF INSTR(1,PathName$,":") = 0 THEN PathName$ = PathName$ + ":"
ThePBRec.ioVolIndex% = -1
ThePBRec.ioVRefNum% = 0
ThePBRec.ionamePtr& = @PathName$
OSErr = FN GETVOLINFO(@ThePBRec)
VRefNum&.nil% = ThePBRec.ioVRefNum%
END FN = OSErr
- sent via BulkRate (http://members.aol.com/gregneagle/bulkrate/)