[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'amigados' (#aros)


Set the current position for reading and writing


Source position: amigados.pas line 2255

function DOSSeek(

  File_: BPTR;

  Position: LongInt;

  Mode: LongInt





Pointer to file handle.



Value to seek (can be also negative for OFFSET_CURRENT or OFFSET_END)



Start of Seek (OFFSET_*)

Function result

Returns the position before the seek.


DosSeek() sets the read/write cursor for the file file to the position 'position'. This position is used by both DosRead() and DosWrite() as a place to start reading or writing. The result is the current absolute position in the file, or -1 if an error occurs, in which case IoErr() can be used to find more information. mode can be OFFSET_BEGINNING (Start seek from file start), OFFSET_CURRENT (start seek from current position) or OFFSET_END (start seek from end of file). It is used to specify the relative start position. For example, 20 from current is a position 20 bytes forward from current, -20 is 20 bytes back from current.

So that to find out where you are, seek 0 from current. The end of the file is a Seek() positioned by 0 from end. You cannot Seek() beyond the end of a file.

See also



Read bytes of data from a file



Write bytes of data to a file



Sets the size of a file

Documentation generated on: 2017-01-10