8.2.1 File-Handle Functions

Beginning with version 2.0, MS-DOS has included file-handle functions. All programs (except those that must be compatible with MS-DOS versions earlier than version 2.0) should use these functions for file management.

When a program opens or creates a file, MS-DOS assigns a unique handle to that file. The program can use the handle to access the file until the program closes the file. In some cases, a program can use a handle to read from and write to a device as if it were a file.

Following are the MS-DOS file-handle functions:

Function Description Version

3Ch Create File with Handle 2.0
3Dh Open File with Handle 2.0
3Eh Close File with Handle 2.0
3Fh Read File or Device 2.0
40h Write File or Device 2.0
41h Delete File 2.0
42h Move File Pointer 2.0
4300h Get File Attributes 2.0
4301h Set File Attributes 2.0
45h Duplicate File Handle 2.0
46h Force Duplicate File Handle 2.0
56h Rename File 2.0
5700h Get File Date and Time 2.0
5701h Set File Date and Time 2.0
5Ah Create Temporary File 3.0
5Bh Create New File 3.0
67h Set Maximum Handle Count 3.3
68h Commit File 3.3
6Ch Extended Open/Create 4.0