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
◄Example► ◄Back► ◄Contents► ◄Index►
──────────────────────────────────────────────────────────────────────────────
;* 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:PTR BYTE
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
jnc exit ; If ok, return AX = handle
mov ax, -1 ; Else set error code
exit: ret
CreateFile ENDP
-♦-