181 lines
5.5 KiB
HTML
181 lines
5.5 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>QlgRmdir()--Remove Directory (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-->
|
||
|
<!-- Change History: -->
|
||
|
<!-- 011022 JTROUS Changes from API Review 1, V5R2 -->
|
||
|
<!-- 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 type="text/javascript" language="Javascript" src="../rzahg/synch.js">
|
||
|
</script>
|
||
|
|
||
|
<h2>QlgRmdir()--Remove Directory (using NLS-enabled path name)</h2>
|
||
|
|
||
|
<div class="box" style="width: 60%;">
|
||
|
<br>
|
||
|
Syntax<br>
|
||
|
|
||
|
|
||
|
<pre>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
int QlgRmdir(Qlg_Path_Name_T <em>*path</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="rmdir.htm">rmdir()</a>.<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
</div>
|
||
|
|
||
|
<p>The <strong>QlgRmdir()</strong> function, like the <strong>rmdir()</strong>
|
||
|
function, removes a directory, <em>path</em>, provided that the directory is
|
||
|
empty; that is, the directory contains no entries other than "dot"
|
||
|
(<strong>.</strong>) or "dot-dot" (<strong>..</strong>). The difference is that
|
||
|
the <strong>QlgRmdir()</strong> function takes a pointer to a Qlg_Path_Name_T
|
||
|
structure, while <strong>rmdir()</strong> takes a pointer to a character
|
||
|
string.</p>
|
||
|
|
||
|
<p>Limited information on the <em>path</em> parameter is provided here. For
|
||
|
more information on the <em>path</em> parameter and for a discussion of
|
||
|
authorities required, return values, usage notes, and related information, see
|
||
|
<a href="rmdir.htm">rmdir()</a>--Remove Directory.</p>
|
||
|
|
||
|
<br>
|
||
|
<h3>Parameters</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong><em>path</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 directory to be removed. 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="rmdir.htm">rmdir()</a>--Remove Directory<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li><a href="mkdiru.htm">QlgMkdir()</a>--Make Directory (using NLS-enabled path
|
||
|
name)<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li><a href="qp0lunlk.htm">Qp0lUnlink()</a>--Remove Link to File (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 directory:</p>
|
||
|
|
||
|
<pre>
|
||
|
#include <sys/stat.h>
|
||
|
#include <unistd.h>
|
||
|
#include <stdio.h>
|
||
|
#include <sys/stat.h>
|
||
|
#include <fcntl.h>
|
||
|
#include <Qp0lstdi.h>
|
||
|
|
||
|
main() {
|
||
|
|
||
|
#define mypath_d "new_dir"
|
||
|
#define mypath_f "new_dir/new_file"
|
||
|
|
||
|
const char US_const[3]= "US";
|
||
|
const char Language_const[4] ="ENU";
|
||
|
typedef struct pnstruct
|
||
|
{
|
||
|
Qlg_Path_Name_T qlg_struct;
|
||
|
char pn[100]; /* This array size must be >= the */
|
||
|
/* length of the path name or must */
|
||
|
/* be a pointer to the path name. */
|
||
|
};
|
||
|
struct pnstruct path_d;
|
||
|
struct pnstruct path_f;
|
||
|
|
||
|
int file_descriptor;
|
||
|
|
||
|
/***************************************************************/
|
||
|
/* Initialize Qlg_Path_Name_T parameters */
|
||
|
/***************************************************************/
|
||
|
memset((void*)&path_d, 0x00, sizeof(struct pnstruct));
|
||
|
path_d.qlg_struct.CCSID = 37;
|
||
|
memcpy(path_d.qlg_struct.Country_ID,US_const,2);
|
||
|
memcpy(path_d.qlg_struct.Language_ID,Language_const,3);
|
||
|
path_d.qlg_struct.Path_Type = QLG_CHAR_SINGLE;
|
||
|
path_d.qlg_struct.Path_Length = sizeof(mypath_d)-1;
|
||
|
path_d.qlg_struct.Path_Name_Delimiter[0] = '/';
|
||
|
memcpy(path_d.pn,mypath_d,sizeof(mypath_d)-1);
|
||
|
|
||
|
memset((void*)&path_f, 0x00, sizeof(struct pnstruct));
|
||
|
path_f.qlg_struct.CCSID = 37;
|
||
|
memcpy(path_f.qlg_struct.Country_ID,US_const,2);
|
||
|
memcpy(path_f.qlg_struct.Language_ID,Language_const,3);
|
||
|
path_f.qlg_struct.Path_Type = QLG_CHAR_SINGLE;
|
||
|
path_f.qlg_struct.Path_Length = sizeof(mypath_f)-1;
|
||
|
path_d.qlg_struct.Path_Name_Delimiter[0] = '/';
|
||
|
memcpy(path_f.pn,mypath_f,sizeof(mypath_f)-1);
|
||
|
|
||
|
|
||
|
if (QlgMkdir((Qlg_Path_Name_T *)&path_d,S_IRWXU|S_IRGRP|S_IXGRP) !
|
||
|
perror("QlgMkdir() error");
|
||
|
else if ((file_descriptor = QlgCreat((Qlg_Path_Name_T *)&path_f,S_IWUSR)) <
|
||
|
perror("QlgCreat() error");
|
||
|
else {
|
||
|
close(file_descriptor);
|
||
|
QlgUnlink((Qlg_Path_Name_T *)&path_f);
|
||
|
}
|
||
|
|
||
|
if (QlgRmdir((Qlg_Path_Name_T *)&path_d) != 0)
|
||
|
perror("QlgRmdir() error");
|
||
|
else
|
||
|
puts("removed!");
|
||
|
}
|
||
|
</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>
|
||
|
|