Cicode Programming Reference > Cicode Function Categories > Device Functions Introduction > DevSeek

DevSeek

Moves the device pointer to a specified position in the device. If the device is a database, and it is opened in indexed mode, DevSeek will seek to the record number - not through the index. To locate the first record in an indexed device, call the DevFirst() function.

Syntax

DevSeek(hDev, Offset)

hDev:

The device handle, returned from the DevOpen() function. The device handle identifies the table where all data on the associated device is stored.

Offset:

The offset in the device. If the device is a database device, the offset is the record number. If the device is a binary device, the offset is in bytes (from 0 to the maximum file size -1).

Note: If offset causes a seek past the end of the file, DevSeek returns no error, but sets the EOF flag (that is, a subsequent DevEOF() call will return true).

Return Value

0 (zero) if the seek was successful, otherwise an error code is returned.

Related Functions

DevOpen, DevEOF, DevRecNo, DevFirst

Example

hDev=DevOpen("Log", 0);
DevSeek(hDev,100);
DevGetField(hDev,"Tag");
! Gets the value of the "Tag" field at record 100.

See Also

Device Functions