Unit 'amigados' Package
[Overview][Constants][Types][Procedures and functions][Index] [#amunits]

DOSSeek

Set the current position for reading and writing

Declaration

Source position: amigados.pas line 1622

function DOSSeek(

  file_: LongInt;

  position: LongInt;

  offset: LongInt

):LongInt;

Arguments

file_

  

Pointer to file handle.

position

  

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

Function result

Returns the position before the seek.

Description

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

DosRead

  

Read bytes of data from a file

DosWrite

  

Write bytes of data to a file

SetFileSize

  

Sets the size of a file


Documentation generated on: 2021-07-30