Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
CreateNew
 Map                                       Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
;* CreateNewFile - Creates a new file with specified attribute. Differs
;* from the CreateFile procedure in that it returns an error if file
;* already exists. For DOS versions 3.0 and higher.
;*
;* Shows:   DOS Function - 5Bh (Create New File)
;*
;* Params:  Attr - Attribute code (see header comments for CreateFile)
;*          Fspec - Pointer to ASCIIZ file specification
;*
;* Return:  Short integer with file handle or -1 for error
 
CreateNewFile PROC USES ds,
        Attr:WORD,
        Fspec:PBYTE
 
        LoadPtr ds, dx, Fspec           ; Point DS:DX to file spec
        mov     cx, Attr                ; CX = attribute
        mov     ah, 5Bh                 ; AH = function number
        int     21h                     ; Create New File
        .IF     carry?
        mov     ax, -1                  ; Set error code
        .ENDIF
        ret
 
CreateNewFile ENDP
                                    -♦-