Intel® Fortran Compiler 17.0 Developer Guide and Reference
Portability Function: Renames a file.
USE IFPORT
result = RENAMEFILEQQ (oldname,newname)
oldname |
(Input) Character*(*). Current name of the file to be renamed. |
newname |
(Input) Character*(*). New name of the file to be renamed. |
The result type is LOGICAL(4). The result is .TRUE. if successful; otherwise, .FALSE..
You can use RENAMEFILEQQ to move a file from one directory to another on the same drive by giving a different path in the newname parameter.
If the function fails, call GETLASTERRORQQ to determine the reason. One of the following errors can be returned:
ERR$ACCES - Permission denied. The file's permission setting does not allow the specified access.
ERR$EXIST - The file already exists.
ERR$NOENT - File or path specified by oldname not found.
ERR$XDEV - Attempt to move a file to a different device.
USE IFPORT
USE IFCORE
INTEGER(4) len
CHARACTER(80) oldname, newname
LOGICAL(4) result
WRITE(*,'(A, \)') ' Enter old name: '
len = GETSTRQQ(oldname)
WRITE(*,'(A, \)') ' Enter new name: '
len = GETSTRQQ(newname)
result = RENAMEFILEQQ(oldname, newname)
END