LastRecord Read the last data record. Short Name LSTREC() Type ISAM function Declaration COUNT LastRecord(COUNT filno, pVOID recptr) Description LastRecord() retrieves the last data record found. If filno designates an index file, LastRecord() reads the last data record based on the key sequential order of entries in index file number filno. If filno designates a data file, LastRecord() reads the last active data record, in physical sequential order. If successful, the last record becomes the current ISAM record for the associated data file. If an error occurs or there are no entries, the current ISAM record is not updated. If LastRecord() is called with an index number, the data file number involved is not directly described. The ISAM parameters described in “ISAM Functions” of the c-tree Plus Programmer’s Reference Guide contain the correspondence between the index number and the associated data file. Return
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values. Example COUNT keyfil,datfil; TEXT recbuf[320];
printf("\nError %d retrieving last record.", isam_err);
else if (ReReadVRecord(datfil,recbuf,320)) printf("\nError %d retrieving variable portion.", isam_err);
else printf("\nSuccessful LastRecord.");
Limitations No check is made to determine if recptr points to a region sufficiently large to accept a data record. If the area is too small, either code or data will be clobbered. filno cannot be a data file number if any of the following are true:
In any of the above cases, LastRecord() returns FMOD_ERR (48). If filno is a key number whose associated data file has variable-length records, only the fixed-length portion, defined by dreclen in the original call to CreateIFile(), is actually read into the buffer pointed to by recptr. If you wish to read the entire variable-length record into the same or a different buffer, issue a call to ReReadVRecord() after the call to LastRecord(). Note that ReReadVRecord() requires the size of the buffer area so that it can check if sufficient space is available. See also NextRecord(), PreviousRecord(), FirstRecord(), CreateIFile(), ReReadVRecord() |
|||||||||||||||||||||