Harbour Reference Guide

 

FRENAME()

Renames a file

Syntax

FRENAME( <cOldFile>, <cNewFile> ) --> nSuccess

Arguments

<cOldFile> Old filenarne to he changed

<cNewFile> New filename

Returns

<nSuccess> If sucessful, a 0 will he returned otherwise, a -1 will be returned.

Description

This function renames the specified file <cOldFile> to <cNewFile>. A filename and/or directory name may be specified for either para- meter. However, if a path is supplied as part of <cNewFile> and this path is different from either the path specified in <cOldFile> or (if none is used) the current drive and directory, the function will not execute successfully.

Neither parameter is subject to the control of the SET PATH TO or SET DEFAULT TO commands. In attempting to locate the file to be renamed, this function will search the default drive and directory or the drive and path specified in <cOldFile>. It will not search directories named by the SET PATH TO and SET DEFAULT TO commands or by the DOS PATH statement.

If the file specified in <cNewFile> exists or the file is open, the function will be unable to rename the file.If the function is unable to complete its operation,it will return a value of -1. If it is able to rename the file, the return value for the function will be 0.A call to FERROR() function will give additional infor- mation about any error found.
Examples
      nResult:=FRENAME("x.txt","x1.txt")
      IF nResult <0
         ? "File could not be renamed."
      ENDIF
Status

Ready

Compliance

This function is CA-Clipper compliant

Files

Library is Rtl

See Also

 




[Source Forge]

Other Docs Categories

Advantage Database RDD
Array
Binary conversion
Classes
Code Block
Console input
Conversion
Conversion Tools
DOS
Data input and output
Database
Database Tools
Date
Dos Tools
Environment
Error recovery
Events
File management
GT
Harbour Tools
Internal
Low Level
Math
Misc
Miscellaneous
Nation
Object manipulation
Operating System Specific
Parameter Checks
String Tools
Strings
TBrowse Method
TBrowse class
Terminal
Time
Utility
Variable Management

 

Last updated on 2001/07/30