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.
RenameFile
◄Map► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
;* RenameFile - Renames specified file.
;*
;* Shows: DOS Function - 56h (Rename File)
;*
;* Params: Fspec1 - Pointer to old ASCIIZ file specification
;* Fspec2 - Pointer to new ASCIIZ file specification
;*
;* The drive must be the same for both arguments, but the path
;* does not. This allows files to be moved between directories.
;*
;* Return: Short integer with error code
;* 0 if successful
;* 1 if error
RenameFile PROC USES ds di,
Fspec1:PBYTE,
Fspec2:PBYTE
LoadPtr ds, dx, Fspec1 ; Point DS:DX to old file spec
LoadPtr es, di, Fspec2 ; Point ES:DI to new file spec
mov ah, 56h ; AH = function number
int 21h ; Rename File
mov ax, 0 ; Clear error code, keep flags
.IF carry?
inc ax ; Set error code to 1
.ENDIF
ret
RenameFile ENDP
-♦-