ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/unlinku.htm

149 lines
4.3 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>QlgUnlink()--Remove Link to File (using NLS-enabled path name)</title>
<!-- 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. -->
<!-- Begin Header Records --><!-- 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>QlgUnlink()--Remove Link to File (using NLS-enabled path name)</h2>
<div class="box" style="width: 50%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;Qp0lstdi.h&gt;
int QlgUnlink(Qlg_Path_Name_T <em>*Path_Name</em>);
</pre>
&nbsp;&nbsp;Service Program Name: QP0LLIB1<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Conditional; see Usage Notes for <a
href="open.htm">open()</a>.<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>QlgUnlink()</strong> function, similar to the <strong>
unlink()</strong> function, removes a directory entry that refers to a file.
<strong>QlgUnlink()</strong>differs from <strong>unlink()</strong> in that the
<em>Path_Name</em> parameter is a pointer to a Qlg_Path_Name_T structure
instead of a pointer to a character string.</p>
<p>For more information on the <em>*Path_Name</em> parameter and a discussion
of the authorities required, return values, and related information, see <a
href="unlink.htm">unlink()</a>--Remove Link to File.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong><em>Path_Name</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 object to be unlinked. For more information
on the Qlg_Path_Name_T structure, see <a href="../apiref/pns.htm">Path name
format</a>.</dd>
</dl>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="unlink.htm">unlink()</a>--Remove Link to File</li>
<li><a href="link.htm">link()</a>--Create Link to File</li>
<li><a href="openu.htm">QlgOpen()</a>--Open a File (using NLS-enabled path
name)</li>
<li><a href="rmdiru.htm">QlgRmdir()</a>--Remove Directory (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>The following example removes a link to a file. This program was stored in a
source file with CCSID 37, so the constant string "newfile" will be compiled in
CCSID 37. Therefore, the country or region and language specified are United
States English, and the CCSID specified is 37.</p>
<pre>
#include &lt;fcntl.h&gt;
#include &lt;stdio.h&gt;
#include &lt;Qp0lstdi.h&gt;
main() {
const char US_const[3]= "US";
const char Language_const[4]="ENU";
struct pnstruct
{
Qlg_Path_Name_T qlg_struct;
char pn[7];
};
struct pnstruct pns;
struct pnstruct *pns_ptr = NULL;
char fn[]="unlink.file";
memset((void*)&amp;pns, 0x00, sizeof(struct pnstruct));
pns.qlg_struct.CCSID = 37;
memcpy(pns.qlg_struct.Country_ID,US_const,2);
memcpy(pns.qlg_struct.Language_ID,Language_const,3);;
pns.qlg_struct.Path_Type = 0;
pns.qlg_struct.Path_Length = sizeof(fn)-1;
pns.qlg_struct.Path_Name_Delimiter[0] = '/';
memcpy(pns.pn,fn,sizeof(fn)-1);
pns_ptr = &amp;pns;
if (QlgUnlink((Qlg_Path_Name_T *)&amp;pns) != 0)
{
perror("QlgUnlink() error");
}
else printf("QlgUnlink() successful");
}
</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>