Iterating through all mounted volumes

TVolumesIterator iterates through all mounted volumes. This iterator only returns TVolume instances; it does not iterate through the directories or files on the volumes.

NOTE The CommonPoint application system on a UNIX host recognizes all mounted volumes. Using TVolumesIterator in a UNIX environment returns a correct TVolume for each mounted volume.

Example::DisplayVolumes defines a member function that displays the name of each mounted volume. The code uses two functions, PrintText and PrintName, which do not appear in this sample.

      TVolume Example::DisplayVolumes () const
      {
          PrintText("Displaying all volume names...\n\n");
      
          // Create an iterator 
      
          TVolumesIterator volumeIterator;
      
          // Create a volume instance equal to the first volume that the iterator 
          // encounters, and remember that name.
      
          TVolume aVolume = volumesIterator.First;
      
          // keep iterating as long as there are volumes left to iterate through
      
          while (aVolume != TVolumesIterator::kEndOfIteration)
          {
              PrintName(aVolume.GetName());
              aVolume = volumesIterator.Next();
          }
      }

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker