Richard Coutts wrote:
>>> I need to be pointed in the right direction.  My app currently
>>> supports a single memory card, but I want to add support for the
>>> T5's "second" memory card -- the removable one.  (At the moment, my
>>> app only sees the "internal" card.)
>>
>> You've got the loop already.  I believe you just need to select the
>> volume you want, which means not immediately exiting from the
>> loop after the first call to VFSVolumeEnumerate().  So basically
>> just change your if statement's condition to:
>>
>> if (err == errNone && ThisIsTheVolumeWeWant()) return volRefNum;
>
> Logan, That seam to have done the trick, thanks.  So my function to
> retrieve a volume number now looks like this
>
>     Err cfVolNum(
>          UInt16& volNum,    // returned
>          UInt8 cardIndex)      // 0 for first card, 1 for second, etc.
>     {
>          Err err;
>          UInt32 volIterator = vfsIteratorStart;
>          while (volIterator != vfsIteratorStop) {
>               err = VFSVolumeEnumerate(&volNum, &volIterator);
>               if (err == errNone) {
>                    // found a volume -- return if it's the one we want
>                    if (cardIndex == 0)
>                         return errNone;
>                    else
>                         cardIndex--;
>               }
>          }
>          return expErrCardNotPresent;
>     }
>
> So it assumes that the i'th volume corresponds to the i'th card -- is
> this correct?  Volumes are a mystery to me and are like a lot of
> things that I program -- I wish I had the time to explore and learn
> about, but just don't have the time.

For each volume you look at, you should use VFSVolumeInfo() to get the info
structure for the volume. If the volume is the internal drive, the
.attributes member of the info structure will have the
vfsVolumeAttrNonRemovable bit set. The (removable) card won't.

-- 
Martin



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to