The LazyBoy Library Manual - FilePos

Part of the File group.

%imacro FilePos 2
Prefers: DX:AX, BX

Return the current position for a file handle. If successful CF will be clear and the position will be returned. On error, the CF will be set, DX will be 0 and AX will be the error code. Also, the IO_ERROR value will be updated.

This function may also be used with the Text Writer when writing to a memory buffer to determine the current position in the buffer. The Text Writer must be assigned to the same output requested by FilePos or an error will be returned. Sequential character writing devices (like wdCONSOLE) always return 0 as their position.

  • %1 is Register Pair or Memory Reference
  • %2 is File Handle

Examples:

    FilePos dx:ax, bx       ; get 32-bit file position as register pair.
    FilePos [di], bx        ; store 32-bit file position at [DS:DI]
    FilePos dx:ax, wdMEMORY ; return position in Text Writer buffer.

See also FileSeek, FileSize and IO_ERROR.