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

160 lines
4.7 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>Qp0lUnlink()--Remove Link to File</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. -->
<!-- Unix2 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- Change History: -->
<!-- 011022 JTROUS Changes from API Review 1, V5R2 -->
<!-- 0206?? JET This file has undergone html cleanup -->
<!-- 050422 JTROUS Changes from API Review 1, V5R4 -->
<!--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 type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<h2>Qp0lUnlink()--Remove Link to File</h2>
<div class="box" style="width: 80%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;Qp0lstdi.h&gt;
int Qp0lUnlink(Qlg_Path_Name_T <em>*path_name</em>);
</pre>
<br>
&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 on <a href="open.htm">open()
API</a>.&nbsp;&nbsp;<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>Qp0lUnlink()</strong> function, similar to the <strong>
unlink()</strong> function, removes a directory entry that refers to a file.
<strong>Qp0lUnlink()</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 a discussion of the authorities required, return values, and related
information, see <a href="unlink.htm">unlink()--Remove Link to File</a>.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong><em>Path_Name</em></strong></dt>
<dd>(Input) The path name of the object to be unlinked. This path name is in
the Qlg_Path_Name_T format. For more information on this structure, see <a
href="../apiref/pns.htm">Path Name Format</a>.</dd>
</dl>
<br>
<h3>Related Information</h3>
<ul>
<li>The &lt;<strong>unistd.h</strong>&gt; file (see <a href="unix13.htm">Header
Files for UNIX-Type Functions</a>)
</li>
<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="open.htm">open()</a>--Open File
</li>
<li><a href="close.htm">close()</a>--Close File or Socket Descriptor
</li>
<li><a href="rmdir.htm">rmdir()</a>--Remove Directory</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
coded character set identifier (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";
const char Path_Name_Del_const[2] = "/";
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;
memcpy(pns.qlg_struct.Path_Name_Delimiter,
Path_Name_Del_const,1);
memcpy(pns.pn,fn,sizeof(fn));
memset((void *)&amp;Attr_types_ptr, 0x00,
sizeof(struct attrStruct));
pns_ptr = &amp;pns;
if (Qp0lUnlink((Qlg_Path_Name_T *)&amp;pns) != 0)
perror("Qp0lunlink() error");
}
</pre>
<br>
<hr>
API introduced: V4R4
<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>