Solved

finding volume reference numbers

Posted on 1998-09-13
2
174 Views
Last Modified: 2013-12-26
How can I find the volume reference numbers of ALL available  mounted volumes?
0
Comment
Question by:dwp090598
2 Comments
 

Author Comment

by:dwp090598
ID: 1291527
figured out the solution to my problem using:

pb.ioNamePtr = aString;
pb.ioVRefNum = 0;
      
      for(i=1; aErr != nsvErr; i++)
      {
          pb.ioVolIndex = i;
          aErr = PBHGetVInfo((HParmBlkPtr)&pb, false);
 }
0
 
LVL 3

Accepted Solution

by:
boonstra earned 100 total points
ID: 1291528
Actually, you want to start with ioVolIndex = 0:

  HParamBlockRec hpBlock;
  HVolumeParam *hpb = &hpBlock.volumeParam;
  OSErr err;
  Str31 volName;
  short volIndex;
  Boolean notDone = true;
 
  hpb->ioNamePtr = volName;
  hpb->ioResult = 0;
 
  volIndex=0;
 
  do {
        hpb->ioVRefNum = 0;
        hpb->ioVolIndex = volIndex++;
        err = PBHGetVInfo(&hpBlock,false);
        if (noErr != err) break;

        p2cstr(volName);
        printf("Volume [%d] %s vRefNum = %d\n",hpb->ioVolIndex,volName,hpb->ioVRefNum);

  } while (notDone);

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now