WriteVData
Write variable-length data record.
Short Name
WRTVREC()
Type
Low-Level variable-length record function
Declaration
COUNT WriteVData(FILNO datno, LONG recbyt, pVOID recptr, VRLEN varlen)
Description
In V12 the file number typedef was formally changed from COUNT, a two-byte value to FILNO, a four-byte value. Refer to this link for compatibility details. Four Byte File Numbering
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 Error Codes for a complete listing of valid c-tree error values.
Example
LONG recbyt;
FILNO 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 Record Offsets Under Huge File Support.
See also
WriteData(), ReadVData()