Everything

 

long lseek (long fileno, long offset, long base)


[Description]

-

Sets the position within the file, in byte units, for reading from and writing to the file.

-

The position within a new file should be calculated and set using the following methods, depending on the third parameter (base).

(1) When base is 0: Set the position at offset bytes from the file beginning

(2) When base is 1: Set the position at the current position plus offset bytes

(3) When base is 2: Set the position at the file size plus offset bytes

-

When the file is a console, printer, or other interactive device, when the new offset is negative, or when in cases (1) and (2) the file size is exceeded, an error occurs.

-

When the file position is set correctly, the new position for reading/writing should be returned as an offset from the file beginning; when the operation is not successful, -1 should be returned.

[Return value]

Normal: The new position for file reading/writing, as an offset in bytes
from the file beginning

Error: -1

[Parameters]

fileno File number

offset Position for reading/writing, as an offset (in bytes)

base Starting-point of the offset