CurrentFileOffset
Returns the byte position, (file address or offset), of the current ISAM record for the specified file.
Short Name
GETCURP()
Type
ISAM function
Declaration
LONG CurrentFileOffset(FILNO datno);
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
CurrentFileOffset() returns the byte position, (file address), of the current ISAM record for file datno. Use this if you need to access the current ISAM record with a Low-Level function.
This function has been optimized for the client/server model by maintaining the current record pointer information on the client side in addition to the Server side. When CurrentFileOffset() is used with the client/server model, the client is able to retrieve the necessary value from the local machine in most cases. This reduces network traffic and increases performance.
This function is typically used when switching from ISAM to Low-Level work. When switching back to ISAM level, be sure to call one of the functions in “See Also” below to reset the ISAM buffers.
Return
CurrentFileOffset() returns the byte position of the current ISAM record. Zero is returned if there is no current ISAM record for the specified datno, or if an error occurs. On a zero return, check isam_err for a non-zero value indicating the error. See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.
Example
FILNO datfil;
TEXT recbuf[320];
if (FirstRecord(datfil,recbuf) == NO_ERROR)
printf("\nfirst Record is at %ld",
CurrentFileOffset(datfil));
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. For more information, see Record Offsets Under Huge File Support.
See also
SetRecord, ReadISAMData, GetRecord