Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- DOS 5.0 Ref. - <b>function 40h write file or device</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function 40h            Write File or Device

    Writes bytes from a buffer to an open file or device.

        Entry   AH    = 40h
                BX    = Handle of file or device
                CX    = Number of bytes to write (> 0)
                DS:DX = Address of buffer

        Return  AX = Number of bytes written
                or
                AX = Error code, if CF is set
                     | 05h Access denied (file is read-only)
                     | 06h Invalid handle

    ------------------------------------------------------------------

    This function writes data to the file or device whose handle is in
    BX. When DOS writes to a file, it writes data starting at the
    current location of the file pointer. When this function returns,
    the file pointer is positioned at the byte immediately following
    the last byte written to the file (i.e. incremented by the number
    of bytes written).

    A program can write bytes to anywhere in the file by calling
    function 42h (LSEEK) to move to file pointer before writing data.

    Writing 0 (zero) bytes truncates the file at the current position
    of the file pointer.

    If the number of bytes written is smaller than the number
    requested, the destination file or disk is full. The carry flag is
    not set in this situation.

See Also: 42h 3eh 5ah 68h 59h 4400h Dev08h StdDevices

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson