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

VSwrite/vsfwrt/vsfwrtc

int32 VSwrite(int32 vdata_id, unsigned char *databuf, int32 n_records, int32 interlace)
vdata_id

IN:

Vdata access identifier returned from VSattach

databuf

IN:

Buffer of records to be stored in the vdata

n_records

IN:

Number of records to be stored

interlace

IN:

Interlace mode of the buffer in memory

Purpose

Writes data to the specified vdata.

Return value

Returns the total number of records written if successful and FAIL (or -1) otherwise.

Description

Given a buffer containing data to be written and a vdata with write access, this routine writes the data from the buffer to the vdata. The n_records argument specifies the number of record to be written and interlace defines the interlace mode of the vdata fields to bewritten to. Selecting FULL_INTERLACE fills the vdata by record, i.e. all fields in a record are filled before moving to the next record. FULL_INTERLACE is recommended for speed and efficiency. Specifying NO_INTERLACE fills the vdata by field, - i.e. the first field in each record is filled before moving to next series of fields.

Before writing data to a newly created vdata, define the format of the vdata via a call to VSsetfields. If the vdata already exists, VSsetfields is unnecessary because data can only be written to a vdata in compliance with its existing format.

The data in the databuf parameter is assumed to be organized in memory as specified by the interlace argument. It is also assumed to contain the exact number and order of data fields defined in the last call to VSsetfields. VSwrite writes the contents of databuf contiguously to the vdata, therefore any "padding" or non-data spaces used for record or field alignment must be removed before attempting to write from databuf to the vdata. This can be done either by the calling program or by VSfpack. The latter is recommended.

The interlace parameter specifies how the data exists within the buffer databuf. If the data is to be stored in a vdata with an interlace different from that of the buffer, VSsetinterlace must be called prior to VSwrite. In most cases this is unnecessary since the default interlace type of FULL_INTERLACE is used. Refer to the Reference Manual page on VSsetfields, VSseek, VHstoredata.

Note that there are two Fortran-77 versions of this routine; one for buffered numeric data (vsfwrt) and the other for buffered character data (vsfwrtc).

FORTRAN

integer function vsfwrt(vdata_id, databuf, n_records, interlace)

integer vdata_id, n_records, interlace

<valid numeric data type> databuf(*)

integer function vsfwrtc(vdata_id, databuf, n_records, interlace)

integer vdata_id, n_records, interlace

character* (*) databuf



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

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