en:docs:dos:api:int21:42

Note: This API call is for DOS personality only. Use Family API for portability.

2018/09/07 07:04 · prokushev

Int 21H, AH=42H

Version

2 and higher

Brief

“LSEEK” - SET CURRENT FILE POSITION

Family API

Input

      AH = 42h
      AL = origin of move
          00h start of file
          01h current file position
          02h end of file
      BX = file handle
      CX:DX = (signed) offset from origin of new file position

Return

CF clear if successful

          DX:AX = new file position in bytes from start of file
      CF set on error
          AX = error code (01h,06h) (see #01680 at AH=59h/BX=0000h)

Notes

for origins 01h and 02h, the pointer may be positioned before the
        start of the file; no error is returned in that case (except under
        Windows NT), but subsequent attempts at I/O will produce errors
      if the new position is beyond the current end of file, the file will
        be extended by the next write (see AH=40h); for FAT32 drives, the
        file must have been opened with AX=6C00h with the "extended size"
        flag in order to expand the file beyond 2GB
BUG:    using this method to grow a file from zero bytes to a very large size
        can corrupt the FAT in some versions of DOS; the file should first
        be grown from zero to one byte and then to the desired large size
        

See also

AH=24h,INT 2F/AX=1228h

Note


en/docs/dos/api/int21/42.txt · Last modified: 2021/04/30 06:35 by prokushev