Name

VixJob_GetNumProperties

Description

int
VixJob_GetNumProperties(VixHandle jobHandle,
                        int resultPropertyID);

Retrieves the number of instances of the specified property. Used to work with returned property lists.

Parameters

VixHandle
The handle of a job object, returned from any asynchronous Vix function.
resultPropertyID
A property ID.

Return Value

int. The number of properties with an ID of resultPropertyID.

Remarks

Side Effects

None.

Requirements

vix.h, since Workstation 6.0.

Example

job = VixVM_ListDirectoryInGuest(vm, guestdir, 0, NULL, NULL);
err = VixJob_Wait(job, VIX_PROPERTY_NONE);
if (VIX_OK != err) {
   fprintf(stderr, "failed to list dir '%s' in vm '%s'(%"FMT64"d %s)\n",
           guestdir, vmpath, err, Vix_GetErrorText(err, NULL));
   goto abort;
}

num = VixJob_GetNumProperties(job, VIX_PROPERTY_JOB_RESULT_ITEM_NAME);
for (i = 0; i < num; i++) {
   char *fname;

   err = VixJob_GetNthProperties(job,
                                 i,
                                 VIX_PROPERTY_JOB_RESULT_ITEM_NAME,
                                 &fname,
                                 VIX_PROPERTY_NONE);

   printf("file #%d '%s'\n", i, fname);

   Vix_FreeBuffer(fname);
}

Vix_ReleaseHandle(job);

Copyright (C) 2007-2010 VMware, Inc. All rights reserved.