rename()--Rename File or Directory


  Syntax
 #include <Qp0lstdi.h>

 int rename(const char *old, const char *new);  
  Service Program Name: QP0LLIB1

  Default Public Authority: *USE

  Threadsafe: Conditional; see Usage Notes.

The rename() function can be defined to be either Qp0lRenameUnlink() or Qp0lRenameKeep(), depending upon the definitions of the _POSIX_SOURCE and _POSIX1_SOURCE macros in the <Qp0lstdi.h> header file:

When the <Qp0lstdi.h> header file is not included, rename() operates only on database files in the QSYS.LIB or independent ASP QSYS.LIB file system, as it did before the introduction of the integrated file system.

For details on the use of rename(), see the Qp0lRenameUnlink() and Qp0lRenameKeep() functions.


Authorities and Locks

None.


Parameters

old
(Input) A pointer to the null-terminated path name of the file to be renamed.

This parameter is assumed to be represented in the CCSID (coded character set identifier) currently in effect for the job. If the CCSID of the job is 65535, this parameter is assumed to be represented in the default CCSID of the job.


new
(Input) A pointer to the null-terminated path name of the new name of the file.

This parameter is assumed to be represented in the CCSID currently in effect for the job. If the CCSID of the job is 65535, this parameter is assumed to be represented in the default CCSID of the job.

The new file name is assumed to be represented in the language and country or region currently in effect for the process.


Usage Notes

  1. This function will fail with error code [ENOTSAFE] when all the following conditions are true:

Related Information



API introduced: V3R1
Top | UNIX-Type APIs | APIs by category