[comp.sys.mac.programmer] GetVol and SetVol Query

gary@sun.mcs.clarkson.edu (Gary Levin) (10/03/89)

Could someone explain the use and affect of GetVol and SetVol?  It
appears from the examples that I have found, that their prototypes are

    void GetVol(char* X, short *volNum);
    void SetVol(char* X, short  volNum);

(1) Are these the correct prototypes?
(2) What is the first parameter for?  All examples I have seen passed
    NULL. 
(3) It looks like SetVol can be used to change the ``default volume''.
    Is this the default volume as far as ``fopen'' is concerned?
(4) Is volNum the value one would get from CFile->volNum?

Thanks.



--
Gary Levin/Dept of Math & CS/Clarkson Univ/Potsdam, NY 13676/(315) 268-2384
BitNet: gary@clutx   Internet: gary@clutx.clarkson.edu

KIrwin@cup.portal.com (Kent Thomas Irwin) (10/05/89)

In article <GARY.89Oct2165209@milo.clarkson.edu>, 
   gary@sun.mcs.clarkson.edu (Gary Levin) writes:

>Could someone explain the use and affect of GetVol and SetVol?  It
>appears from the examples that I have found, that their prototypes are
>
>    void GetVol(char* X, short *volNum);
>    void SetVol(char* X, short  volNum);
>
>(1) Are these the correct prototypes?
>(2) What is the first parameter for?  All examples I have seen passed
>    NULL.
>(3) It looks like SetVol can be used to change the ``default volume''.
>    Is this the default volume as far as ``fopen'' is concerned?
>(4) Is volNum the value one would get from CFile->volNum?

It sounds like you are operating without the benefit of Inside Macintosh :-)
Your prototypes are mostly correct, though both functions return OSErr.
In your prototypes, X is the volume name string, and volNum (more 
appropriately referred to as vRefNum), is the volume reference number.
vRefNum is a required argument for many of the File Manager routines.

SetVol() is indeed used to set the current default volume.  Exactly how this
will help you is unclear.  It sounds like you are using the THINK Class
Library (or similar), in which case you probably should make use of the
methods available in the CFile class.  I just got my LSC 4.0 and am still
getting accustomed to the base classes (haven't got to CFile yet), so I'll

KIrwin@cup.portal.com (Kent Thomas Irwin) (10/05/89)

In article <GARY.89Oct2165209@milo.clarkson.edu>, 
   gary@sun.mcs.clarkson.edu (Gary Levin) writes:

>Could someone explain the use and affect of GetVol and SetVol?  It
>appears from the examples that I have found, that their prototypes are
>
>    void GetVol(char* X, short *volNum);
>    void SetVol(char* X, short  volNum);
>
>(1) Are these the correct prototypes?
>(2) What is the first parameter for?  All examples I have seen passed
>    NULL.
>(3) It looks like SetVol can be used to change the ``default volume''.
>    Is this the default volume as far as ``fopen'' is concerned?
>(4) Is volNum the value one would get from CFile->volNum?

It sounds like you are operating without the benefit of Inside Macintosh :-)
Your prototypes are mostly correct, though both functions return OSErr.
In your prototypes, X is the volume name string, and volNum (more 
appropriately referred to as vRefNum), is the volume reference number.
vRefNum is a required argument for many of the File Manager routines.

SetVol() is indeed used to set the current default volume.  Exactly how this
will help you is unclear.  It sounds like you are using the THINK Class
Library (or similar), in which case you probably should make use of the
methods available in the CFile class.  I just got my LSC 4.0 and am still
getting accustomed to the base classes (haven't got to CFile yet), so I'll
refrain from any advice about methods.
-----------------------------------------------------------------
:-) Kent T. Irwin          Usenet: kirwin@cup.portal.com
:-) Egoware, Ltd.          UUCP: sun!cup.portal.com!kirwin
:-)                        CIS: 76703,3007      GEnie: KENT.IRWIN