DOS Fn 3dH: Open a File via Handle
Expects: AH 3dH
AL Access Mode (0=read, 1=write, 2=both, etc.)
DS:DX address of an ASCIIZ▲ string of a filespec▲
Returns: AX error code if CF is set to CY
file handle if no error
Info: Opens an existing file for read and/or write operations.
DS:DX points to an ASCIIZ string in the form...
...which identifies the location and name of the file to open.
If drive and/or path are omitted, defaults are assumed.
If CF is set on return, an error code is in AX and no action was
Notes: ■ The file must exist. See Fn 3cH (create file).
■ The file is opened in the selected Access Mode / Open Mode.
For compatibility with DOS 2.x and no network involvement, use:
• AL = 0 to open for reading
• AL = 1 to open for writing
• AL = 2 to open for reading and writing
■ The read/write pointer is set to 0. See DOS Fn 42H (Lseek).
■ CONFIG.SYS specifies how many handles are available or you may
use Fn 67H (set handle count) to increase available handles.
■ Fn 6cH has additional options, such as disabling critical
errors and forcing automatic write-through to disk.
See Also: Handle-Oriented File I/O