SEEKBEGIN Function

Sets the file pointer to a position starting at the beginning of the file. Returns true on success, false otherwise. The parameter specifies the position.

Category: External File
Returned data type: Integer
Note: The returned value is a Boolean value where 1= success and 0 = error.

Syntax

fileobject.seekbegin(<position>)

Required Argument

position

an integer specifying the number of bytes that need to be moved forward from the beginning of the file. Specifying a 0 means the start of the file. This parameter can be specified as a number, field name, or expression

Details

The seekbegin method moves the file pointer to the specified location in the file, where 0 indicates the start of the file. It returns true on success; otherwise, false is returned. Specifying 1 means that reading starts after the first position in the file.

Example

file f

string input

 

f.open("C:\filename.txt", "r")

 

input = f.readline()

 

// return the pointer to the beginning of the file

// and read the first line again

f.seekbegin(0)

f.readline()

 

f.close()