Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Int 21h Function 40h
 Detail Example                          Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
  Interrupt:   21h     Function:   40h
 
  Title:       Write File or Device
 
  See also:    Read File or Device, Set File Pointer, @Write
 
  Description:
 
     Given a valid file handle from a previous open or create
     operation, a buffer address, and a length in bytes, this function
     transfers data from the buffer into the file and then updates the
     file pointer position.
 
     Input                                Output
 
     AH = 40h                             If function successful
     BX = Handle                             Carry flag: clear
     CX = Number of bytes to write           AX = Bytes transferred
     DS:DX = segment:offset of buffer
                                          If function unsuccessful
                                             Carry flag: set
                                             AX = Error code (05h or 06H)
                                             See: Error codes
                                    -♦-