Previous Topic

Next Topic

VRecordLength

Get length of current variable length ISAM record.

Short Name

GETVLEN()

Type

ISAM variable-length record function

Declaration

VRLEN VRecordLength(COUNT datno) 

Description

VRecordLength() returns the length of the current ISAM record for variable-length data file datno. If an error occurs, VRecordLength() returns a zero and isam_err is set to the error code.

Ordinarily, VRecordLength() is used to determine the buffer size requirements for the entire record after a call to an ISAM function that reads only the fixed-length portion of the record. ReReadVRecord() can then be called to retrieve the full record. If you already know the maximum possible record length for the data file, it is not necessary to call VRecordLength() before ReReadVRecord().

Return

If no error occurs, VRecordLength() returns the total record length for the current ISAM record. Otherwise, VRecordLength() returns a zero and isam_err is set as follows:

Value

Symbolic Content

Explanation

0

NO_ERROR

Successful return.

48

FMOD_ERR

datno is assigned to a fixed length data file.

100

ICUR_ERR

No current ISAM record for data file.

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

Example

  COUNT     invfil,datfil;
  VRLEN     varlen;
struct invd  {
    LONG     part_no;
    TEXT     part_name[120];
} recbuf;

if (FirstRecord(invfil,&recbuf) == NO_ERROR &&
  (varlen = VRecordLength(datfil))
    printf("\nThe first record is %u bytes long.",varlen);
else
    printf("\nError #%d on file %d",isam_err,isam_fil);

See also

ReReadVRecord(), VDataLength()