191 lines
5.8 KiB
HTML
191 lines
5.8 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
|
|
<title>QlgRenameUnlink()--Rename File or Directory, Unlink "new" If It Exists
|
|
(using NLS-enabled path name)</title>
|
|
<!-- Begin Header Records -->
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<!-- file cleaned -->
|
|
<!-- Created by Yvonne Griffin for V5R1-->
|
|
<!-- This file has undergone html cleanup June 2002 by JET -->
|
|
<!-- End Header Records -->
|
|
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
|
</head>
|
|
<body>
|
|
<a name="Top_Of_Page"></a>
|
|
<!--Java sync-link-->
|
|
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
|
|
</script>
|
|
|
|
<h2>QlgRenameUnlink()--Rename File or Directory, Unlink "new" If It Exists
|
|
(using NLS-enabled path name)</h2>
|
|
|
|
<div class="box" style="width: 65%;">
|
|
<br>
|
|
Syntax<br>
|
|
|
|
|
|
<pre>
|
|
#include <Qp0lstdi.h>
|
|
|
|
int QlgRenameUnlink(Qlg_Path_Name_T <em>*old</em>, Qlg_Path_Name_T <em>*new</em>);
|
|
</pre>
|
|
|
|
Service Program Name: QP0LLIB1<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Default Public Authority: *USE<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Threadsafe: Conditional; see Usage Notes for <a href=
|
|
"renameun.htm">Qp0lRenameUnlink()</a>.<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
</div>
|
|
|
|
<p>The <strong>QlgRenameUnlink()</strong> function, like the <strong>
|
|
Qp0lRenameUnlink()</strong> function, renames a file or a directory specified
|
|
by <em>old</em> to the name given by <em>new</em>. The difference is that the
|
|
<strong>QlgRenameUnlink()</strong> function takes a pointer to a
|
|
Qlg_Path_Name_T structure, while <strong>Qp0lRenameUnlink()</strong> takes a
|
|
pointer to a character string.</p>
|
|
|
|
<p>Limited information on the <em>old</em> and <em>old</em> parameters is
|
|
provided here. For more information on these parameters and for a discussion of
|
|
the authorities required, return values, and related information, see <a href=
|
|
"renameun.htm">Qp0lRenameUnlink()</a>--Rename File or Directory, Unlink "new"
|
|
If It Exists.</p>
|
|
|
|
<br>
|
|
<h3>Parameters</h3>
|
|
|
|
<dl>
|
|
<dt><strong><em>old</em></strong></dt>
|
|
|
|
<dd>(Input) A pointer to a Qlg_Path_Name_T structure that contains a path name
|
|
or a pointer to a path name of the file to be renamed. For more information on
|
|
the Qlg_Path_Name_T structure, see <a href="../apiref/pns.htm">Path name format</a>.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong><em>new</em></strong></dt>
|
|
|
|
<dd>(Input) A pointer to a Qlg_Path_Name_T structure that contains a path name
|
|
or a pointer to a path name of the new name of the file. For more information
|
|
on the Qlg_Path_Name_T structure, <a href="../apiref/pns.htm">Path name format</a>.</dd>
|
|
</dl>
|
|
|
|
<br>
|
|
<h3>Related Information</h3>
|
|
|
|
<ul>
|
|
<li><a href="renameun.htm">Qp0lRenameUnlink()</a>--Rename File or Directory,
|
|
Unlink "new" If It Exists<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="pathconfu.htm">QlgPathconf()</a>--Get Configurable Path Name
|
|
Variables (using NLS-enabled path name)<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="renamekpu.htm">QlgRenameKeep()</a>--Rename File or Directory, Keep
|
|
"new" If It Exists (using NLS-enabled path name)</li>
|
|
</ul>
|
|
|
|
<br>
|
|
<h3>Example</h3>
|
|
|
|
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
|
|
for information pertaining to code examples.</p>
|
|
|
|
<p>When you pass two file names to this example, it tries to change the file
|
|
name from the first name to the second using <strong>
|
|
QlgRenameUnlink()</strong>.</p>
|
|
|
|
<pre>
|
|
#include <Qp0lstdi.h>
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
|
|
if ( argc != 3 )
|
|
{
|
|
printf( "Usage: %s old_fn new_fn\n", argv[0]);
|
|
perror ( "Could not unlink the file" );
|
|
}
|
|
|
|
else
|
|
{
|
|
const char US_const[3]= "US";
|
|
const char Language_const[4]="ENU";
|
|
typedef struct pnstruct
|
|
{
|
|
Qlg_Path_Name_T qlg_struct;
|
|
/*** EXTRA STORAGE MAY BE NEEDED ***/
|
|
char pn[1025]; /* This size must be >= the path */
|
|
/* name length or a pointer to */
|
|
/* the path name. */
|
|
};
|
|
struct pnstruct path_old;
|
|
struct pnstruct path_new;
|
|
|
|
struct pnstruct *path_old_ptr;
|
|
struct pnstruct *path_new_ptr;
|
|
|
|
|
|
memset((void*)&path_old, 0x00, sizeof(struct pnstruct));
|
|
path_old_ptr = &path_old;
|
|
|
|
path_old.qlg_struct.CCSID = 37;
|
|
memcpy(path_old.qlg_struct.Country_ID,US_const,2);
|
|
memcpy(path_old.qlg_struct.Language_ID,Language_const,3);;
|
|
path_old.qlg_struct.Path_Type = 0;
|
|
path_old.qlg_struct.Path_Length = strlen(argv[1]);
|
|
path_old.qlg_struct.Path_Name_Delimiter[0] = '/';
|
|
memcpy(path_old.pn,argv[1],sizeof(argv[1]));
|
|
|
|
|
|
memset((void*)&path_new, 0x00, sizeof(struct pnstruct));
|
|
path_new_ptr = &path_new;
|
|
|
|
path_new.qlg_struct.CCSID = 37;
|
|
memcpy(path_new.qlg_struct.Country_ID,US_const,2);
|
|
memcpy(path_new.qlg_struct.Language_ID,Language_const,3);;
|
|
path_new.qlg_struct.Path_Type = 0;
|
|
path_new.qlg_struct.Path_Length = strlen(argv[2]);
|
|
path_new.qlg_struct.Path_Name_Delimiter[0] = '/';
|
|
memcpy(path_new.pn,argv[2],sizeof(argv[2]));
|
|
|
|
|
|
if (QlgRenameUnlink((Qlg_Path_Name_T *)path_old_ptr,
|
|
(Qlg_Path_Name_T *)path_new_ptr ) != 0)
|
|
{perror ( "Could not unlink the file." ); }
|
|
else {perror ( "File unlinked." ); }
|
|
}
|
|
|
|
}
|
|
</pre>
|
|
|
|
<hr>
|
|
API introduced: V5R1
|
|
|
|
<hr>
|
|
<center>
|
|
<table cellpadding="2" cellspacing="2">
|
|
<tr align="center">
|
|
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
|
|
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
</body>
|
|
</html>
|
|
|