Table des matières

INT 0x21 - 0x40 - Write To File or Device Using Handle

Request/Call:

reg value descr
AH 0x40
BX File Handle
CX number of bytes to write, a zero value truncates/extends the file to the current file position
DS:DX pointer to data buffer to write

Return:

CF cleared : success

reg descr
AX number of written bytes

CF Set: error

reg descr
AX error code (see (see DOS Error Code))

Notes & Comments

  • if AX is not equal to CX on return, a partial write occurred
  • this function can be used to truncate a file to the current file position by writing zero bytes

Back