ReadVData Read variable length data record. Short Name RDVREC() Type Low-level variable-length record function Declaration COUNT ReadVData(COUNT datno, LONG recbyt, pVOID recptr, VRLEN varlen) Description ReadVData() reads the variable-length data record at byte position recbyt for data file datno into the buffer area pointed to by recptr. If varlen, the size of the buffer pointed to by recptr, is not large enough for the variable-length record, ReadVData() returns an error. To ensure varlen is large enough, call VDataLength() before calling ReadVData(). VDataLength() returns the actual length of the record. If the existing buffer is not large enough, a new, larger buffer must be allocated before calling ReadVData(). Note: No check is actually made to be sure that the region pointed to by recptr is in fact as large as varlen indicates. It is up to the application to ensure that varlen accurately specifies the size of the area pointed to by recptr. Return
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values. Example COUNT datno, keyno; VRLEN cur_bufsiz, varlen; pTEXT recptr, calloc(); LONG part_number, pntr;
if ((pntr = GetKey(keyno,&part_number)) != DRNZERO) {
varlen = VDataLength(datno,pntr); if (varlen > cur_bufsiz) {
free(recptr); recptr = calloc(1,varlen)); cur_bufsiz = varlen; } if (ReadVData(datno,pntr,recptr,varlen)) printf>("\nError #%d reading at %ld", uerr_cod, pntr);
} 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 ctSetHgh(), ctGetHgh(), ReReadVRecord(), VDataLength(), WriteVData() |
|||||||||||||||||||||||||||||||||||||||