Sets the file pointer to a position in the file relative to the current position in the file.
Category: | External File |
Returned data type: | Integer |
Note: | The returned value is a Boolean value where 1= success and 0 = error. |
fileobject.seekcurrent(<position>)
position
an integer specifying the number of bytes that need to be moved from the current position in the file. Positive values specify the number of bytes to move forward, negative values specify the number of bytes to move backward. This parameter can be specified as a number, field name, or expression
The seekcurrent method moves the file pointer from the current position in the file. This method is useful when reading binary files that contain offsets to indicate where related information can be found in the file.
file f
string input
f.open("C:\filename.txt", "r")
input = f.readline()
// The file contains 3 bytes per record followed by a CR and LF character
// So move the pointer 3+2=5 positions back to read the beginning of
// the first line and read it again.
f.seekcurrent(-5)
f.readline()
f.close()