Please enable JavaScript to view this site.

A-Shell Reference

Updated May 2023

xcall MIAMEX, MX_FILEPOS, chan, opcode, pos {,filidx}

MX_FILEPOS (MIAMEX 118) allows you to get or set the current file position within a sequential file which is open for input or output.

Parameters

chan  (Num)  [in]

should be set to the channel number of the open sequential file.

opcode  (Num)  [in]

0 (mxop_get) to get the current file position or 1 (mxop_set) to set it.

pos  (Num)   [in/out]

is the position (offset in bytes from the start of file). For opcode 0 (get), the current position is returned in this parameter. For opcode 1 (set), pos must be set to the desired new file position. Note that to support files larger than 2 GB you must use a variable type capable of it: F6 or I6 or B6.

filidx  (B,4)  [in]

is an optional handle to a "file index" which can be created and passed back to you by XTREExs. If filidx is specified and opcode = 1, then rather than setting the file pointer to the byte position specified by pos, it instead interprets pos as the desired line number, and uses the index referenced by filidx to locate that line number directly (without having to scan the file sequentially).

If there is an error in the operation, pos will be returned as -1.

History

2023 May, A-Shell 6.5.1731.0:  Support extended to files beyond the 32 bit 2GB limit.