basic.%lseek.apdos

C Function/BASIC Program, Releases: AP/DOS

Sets MS-DOS file pointer.

Syntax

rc=%lseek( file.handle, ofs.mult, ofs.rem, sflg)

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().

See Also

Command Name Type Description
basic.cfunction Definition Declare a list of C functions.
basic.cfunc Definition can be called from a Pick/BASIC program or subroutine in AP/DOS and AP/Unix implementations using a syntax similar to that of normal C.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.