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 3fh read file or device</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function 3Fh            Read File or Device

    Reads bytes from an open file or device into a buffer.

        Entry   AH    = 3Fh
                BX    = Handle of file or device
                CX    = Number of bytes to read
                DS:DX = Address of buffer

        Return  AX = Number of bytes read into buffer
                or
                AX = Error code, if CF is set
                     | 05h Access denied
                     | 06h Invalid handle

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

    This function reads data from the file or device whose handle is
    in BX. When DOS reads from a file, it reads 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 read from the file (i.e. incremented by the number
    of bytes read).

    If this function returns the carry flag clear and AX = 0, the file
    pointer was at the end of the file when the function was called.
    If the carry flag is clear and AX is less than the number of bytes
    requested, DOS reached the end of the file during the read
    operation.

    A program can read from anywhere in a file by calling function 42h
    (LSEEK) to move to file pointer before reading data.


    This function can also be used to read from the standard input
    device (standard handle 0000h), typically the keyboard. If DOS is
    reading from standard input, this function reads either the
    specified number of bytes, or all bytes up to the next carriage
    return, whichever is less. (If the number of bytes specified is at
    least two larger than the number of characters typed, the
    carriage-return line-feed pair will be returned as the last two
    bytes, and will count as two bytes.)

See Also: 42h 59h 4400h 4b03h Dev04h StdDevices

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