Previous Topic

WriteVData

Write variable length data record.

Short Name

WRTVREC()

Type

Low-level variable-length record function

Declaration

COUNT WriteVData(COUNT datno, LONG recbyt, pVOID recptr, VRLEN varlen)

Description

WriteVData() writes varlen bytes from the record buffer pointed to by recptr into the variable-length data record at record position recbyt for data file datno.

Return

WriteVData() may return the following errors, in addition to those for WriteData().

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful write.

48

FMOD_ERR

datno is not assigned to variable-length file.

148

VLEN_ERR

varlen bytes will not fit into file at position recbyt.

159

VPNT_ERR

recbyt is zero.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example

LONG      recbyt;
COUNT     datno;
TEXT      recptr[1024];

scanf("%1023s",recptr);
recbyt = NewVData(datno,strlen(recptr));
if (WriteVData(datno,recbyt,recptr,strlen(recptr)))
    printf("\nCould not write record. Error #%d", uerr_cod);

Limitations

The recbyt parameter in this function is a 4-byte value capable of addressing at most 4 gigabytes. If your application supports HUGE files (greater than 4 gigabytes), you must use the ctSetHgh() and ctGetHgh() functions to set or get the high order 4 bytes of the file offset.

See also

WriteData(), ReadVData()