FSEEK()

From Recital Documentation Wiki
Revision as of 15:21, 27 October 2009 by Helengeorge (Talk | contribs)

Jump to: navigation, search


Purpose

Function to position to a byte offset within a text file


Syntax

FSEEK(<expN1>, <expN2>, <expN3>)


See Also

FCLOSE(), FCREATE(), FERROR(), FGETS(), FREAD(), FREADSTR(), FWRITE()


Description

The FSEEK() function is used to position to a byte offset within a text file. The <expN1> is a valid file handle returned from the FOPEN() function. The <expN2> is the byte offset position to move the file pointer based on value defined by <expN3>. This can be a positive or negative number depending on the direction of pointer movement. The <expN3> defines the positions from which to start the byte offset, and can be any of the following three options:


Offset Description
0 Start from start of file
1 Start from current position
2 Start from EOF


FSEEK() returns the new position of the file pointer relative to the beginning of the file. The beginning of the file is 0 regardless of the direction of movement.


Example

fp = fopen("names.txt")
string = fgets(fp)
fseek(fp, 1024,0)


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer