basic.%lseek.apdos C Function/BASIC Program

basic.%lseek.apdos

Command basic.%lseek.apdos C Function/BASIC Program
Applicable release versions: AP/DOS
Category BASIC Program (486)
Description moves the file pointer associated with "file.handle" to a given position in the file.

The position the file pointer moves to is an offset expressed in bytes from the position specified by "sflg". The offset is calculated using "ofs.mult" and "ofs.rem" as follows:

offset=(ofs.mult*((32*1024)-1)+ofs.rem)
ofs.mul = int(offset/((32*1024)-1))
ofs.rem = mod(offset,((32*1024)-1))

Where "ofs.mult" and "ofs.rem" are in the range 0 through 32767 and where "sflg" may specify the beginning of the file, the current position in the file, or the end of the file. See the item dm,includes, fcntl.h for the manifest constants that define these. The offset is calculated using 2 numbers because of the current limitation of only being able to pass 16-bit numbers. This way, an offset of close to 1 GB can be addressed. For additional information refer to the MS-C library reference manual for LSEEK().
Syntax rc=%lseek( file.handle, ofs.mult, ofs.rem, sflg)
Options
Example
Purpose
Related basic.cfunction
basic.cfunc