Novell Home

CLIB's NWGetVolumeFlags & GetVolumeName apis

From Developer Community

Shows how to use the APIs NWGetVolumeFlags and GetVolumeName.

Sample Code

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <nwtypes.h>
#include <nwfileio.h>
#include <nit/nwdir.h>

int main(void)
{
   int rcode;
   LONG volNumber;
   LONG flags;
   int x;
   char name[255];

   for (x = 0; x < 256; x++)
   {
      rcode = NWGetVolumeFlags(x, &flags);
      if(!rcode)
      {
         
         memset(name, 0, sizeof(name));
         GetVolumeName(x, name);
         printf("%d:%s has flags: %x\r\n", x, name);
         printf("Sub_Allocation:   %s\r\n", flags & SUB_ALLOCATION_FLAG ? "ON" : "OFF");
         printf("File Compression: %s\r\n", flags & FILE_COMPRESSION_FLAG ? "ON" : "OFF");
         printf("Data Migration:   %s\r\n", flags & DATA_MIGRATION_FLAG ? "ON" : "OFF");
         printf("Imediate Purge:   %s\r\n", flags & VOLUME_IMMEDIATE_PURGE_FLAG ? "ON" : "OFF");
      }

   }
}

--Benjamin Fjeldsted

Novell® Making IT Work As One

© 2008 Novell, Inc. All Rights Reserved.