VDataLength
Get length of variable-length data record.
Short Name
GTVLEN()
Type
Low-Level variable-length data file function
Declaration
VRLEN VDataLength(FILNO datno, LONG recbyt)
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
VDataLength() returns the total length of the variable-length data record beginning at byte offset recbyt in file datno.
Return
If no error occurs, VDataLength() returns the total record length for the specified offset. When VDataLength() returns a zero, check uerr_cod. If uerr_cod is zero, the record length is zero. Otherwise, an error occurred as follows:
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
CTDBRET_OK |
Successful operation. |
29 |
ZREC_ERR |
Data file routine called with recbyt = 0. |
48 |
FMOD_ERR |
Operation incompatible with type of file. The specifics vary by function:
|
149 |
VRLN_ERR |
Variable-length passed to AddVRecord() is less than minimum record length established at file creation. |
154 |
VRCL_ERR |
Attempt to read (R) a zero length record from a variable-length data file. |
158 |
VFLG_ERR |
ReReadVRecord() record not marked active. |
See c-tree Error Codes for a complete listing of valid c-tree error values.
Example
LONG pntr;
VRLEN vreclen;
FILNO datno,keyno;
TEXT key_buffer[64];
if ((pntr = FirstKey(keyno,key_buffer)) != 0L) {
vreclen = VDataLength(datno,pntr);
if (uerr_cod == 0) {
if (vreclen)
printf(
"\nFirst variable record by key requires %d bytes",
vreclen);
else
printf("\nRecord length is zero.");
}
else
printf("\nError %d getting length.", uerr_cod);
}
See also