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.
CreateFile
 Map                                       Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
;* CreateFile - Creates file with specified attribute.
;*
;* Shows:   DOS Function - 3Ch (Create File)
;*
;* Params:  Attr - Attribute code:  0 = normal        8 = volume label
;*                                        1 = read only    16 = subdirectory
;*                                        2 = hidden              32 = archive
;*                                        4 = system
;*          Fspec - Pointer to ASCIIZ file specification
;*
;* Return:  Short integer with file handle or -1 for error
 
CreateFile PROC USES ds,
        Attr:WORD, Fspec:PBYTE
 
        LoadPtr ds, dx, Fspec           ; Point DS:DX to file spec
        mov     cx, Attr                ; CX = attribute
        mov     ah, 3Ch                 ; AH = function number
        int     21h                     ; Create file
        .IF     carry?
        mov     ax, -1                  ; Set error code
        .ENDIF
        ret
 
CreateFile ENDP
                                    -♦-