[Top] [Prev] [Next] [Bottom]

VSsizeof/vsfsiz

int32 VSsizeof(int32 vdata_id, char *fields)
vdata_id

IN:

Vdata access identifier returned from VSattach

fields

IN:

Name(s) of the fields to check

Purpose

Computes the byte size of the given field(s) for the local machine.

Return value

Returns the local machine size in bytes for the field if successful and FAIL (or -1) otherwise. If one than one field is specified, VSsizeof will return the sum of the sizes of all of the fields.

Description

Specify a single field or several fields (comma-separated) in the parameter fields. The field or fields should already exist for that vdata vdata_id.

This routine is useful in determining how much memory needs to be allocated to read in the field or fields in question.

Example

The code segment below uses VSsizeof to compute the byte size of a datavalue of the "DENSITY" field, and uses VSQuerycount to get the total number of records in the vdata. The product gives the total memory size needed to read all the "DENSITY" data values from the vdata.

     int32 varsize, n_records;
     unsigned char *readbuffer;
     int32 vdata_id;

     VSQuerycount(vdata_id, &n_records);
     varsize = VSsizeof(vdata_id,"DENSITY");
     readbuffer = (unsigned char*) malloc(varsize * n_records); 
FORTRAN

integer function vsfsiz(vdata_id, fields)

integer vdata_id

character* (*) fields



[Top] [Prev] [Next] [Bottom]

hdfhelp@ncsa.uiuc.edu
HDF User's Reference Manual, Draft 06/09/97, NCSA HDF Development Group.