Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
DelFile
 Map                                       Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
;* DelFile - Deletes a specified file.
;*
;* Shows:   DOS Function - 41h (Delete File)
;*
;* Params:  Fspec - Pointer to ASCIIZ file specification
;*
;* Return:  Short integer with error code
;*          0 if successful
;*          1 if delete error
 
DelFile PROC USES ds,
        Fspec:PBYTE
 
        LoadPtr ds, dx, Fspec           ; Point DS:DX to file spec
        mov     ah, 41h                 ; DOS Function 41h
        int     21h                     ; Delete File
        mov     ax, 0                   ; Set error code, keep flags
        .IF     carry?
        inc     ax                      ; Set error code to 1
        .ENDIF
        ret
 
DelFile ENDP
                                    -♦-