192 lines
6.0 KiB
HTML
192 lines
6.0 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>QlgStat()--Get File Information (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>QlgStat()--Get File Information (using NLS-enabled path name)</h2>
|
|
|
|
<div class="box" style="width: 60%;">
|
|
<br>
|
|
Syntax<br>
|
|
|
|
|
|
<pre>
|
|
#include <sys/stat.h>
|
|
|
|
int QlgStat(Qlg_Path_Name_T <em>*path</em>,struct stat <em>*buf</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="stat.htm">stat()</a>.<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
</div>
|
|
|
|
<p>The <strong>QlgStat()</strong> function, like the <strong>stat()</strong>
|
|
function, gets status information about a specified file and places it in the
|
|
area of memory pointed to by the <em>buf</em> argument. The difference is that
|
|
the <strong>QlgStat()</strong> function takes a pointer to a Qlg_Path_Name_T
|
|
structure, while <strong>stat()</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 other
|
|
parameters, authorities required, return values, and related information, see
|
|
<a href="stat.htm">stat()</a>--Get File Information.</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 file from which information is required. 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="stat.htm">stat()</a>--Get File Information</li>
|
|
|
|
<li><a href="stat64u.htm">QlgStat64()</a>--Get File Information (large file
|
|
enabled and using NLS-enabled path name)</li>
|
|
|
|
<li><a href="chmodu.htm">QlgChmod()</a>--Change File Authorizations (using
|
|
NLS-enabled path name)</li>
|
|
|
|
<li><a href="chownu.htm">QlgChown()</a>--Change Owner and Group of File (using
|
|
NLS-enabled path name)</li>
|
|
|
|
<li><a href="creatu.htm">QlgCreat()</a>--Create or Rewrite File (using
|
|
NLS-enabled path name)</li>
|
|
|
|
<li><a href="linku.htm">QlgLink()</a>--Create Link to File (using NLS-enabled
|
|
path name)</li>
|
|
|
|
<li><a href="lstatu.htm">QlgLstat()</a>--Get File or Link Information (using
|
|
NLS-enabled path name)</li>
|
|
|
|
<li><a href="mkdiru.htm">QlgMkdir()</a>--Make Directory (using NLS-enabled path
|
|
name)</li>
|
|
|
|
<li><a href="readlinku.htm">QlgReadlink()</a>--Read Value of Symbolic Link
|
|
(using NLS-enabled path name)</li>
|
|
|
|
<li><a href="symlinku.htm">QlgSymlink()</a>--Make Symbolic Link (using
|
|
NLS-enabled path name)</li>
|
|
|
|
<li><a href="utimeu.htm">QlgUtime()</a>--Set File Access and Modification Times
|
|
(using NLS-enabled path name)</li>
|
|
|
|
<li><a href="qp0lunlk.htm">Qp0lUnlink()</a>--Remove Link to File</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 gets status information about a file:</p>
|
|
|
|
<pre>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
|
|
main() {
|
|
struct stat info;
|
|
#define mypath "/"
|
|
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;
|
|
|
|
/***************************************************************/
|
|
/* Initialize Qlg_Path_Name_T parameters */
|
|
/***************************************************************/
|
|
memset((void*)&path, 0x00, sizeof(struct pnstruct));
|
|
path.qlg_struct.CCSID = 37;
|
|
memcpy(path.qlg_struct.Country_ID,US_const,2);
|
|
memcpy(path.qlg_struct.Language_ID,Language_const,3);
|
|
path.qlg_struct.Path_Type = QLG_CHAR_SINGLE;
|
|
path.qlg_struct.Path_Length = sizeof(mypath)-1;
|
|
path.qlg_struct.Path_Name_Delimiter[0] = '/';
|
|
memcpy(path.pn,mypath,sizeof(mypath)-1);
|
|
|
|
if (QlgStat((Qlg_Path_Name_T *)&path, &info) != 0)
|
|
perror("QlgStat() error");
|
|
else {
|
|
puts("QlgStat() returned the following information about root f/s:")
|
|
printf(" inode: %d\n", (int) info.st_ino);
|
|
printf(" dev id: %d\n", (int) info.st_dev);
|
|
printf(" mode: %08x\n", info.st_mode);
|
|
printf(" links: %d\n", info.st_nlink);
|
|
printf(" uid: %d\n", (int) info.st_uid);
|
|
printf(" gid: %d\n", (int) info.st_gid);
|
|
}
|
|
}
|
|
</pre>
|
|
|
|
<p>Output: note that the following information will vary from system to
|
|
system.</p>
|
|
|
|
<pre>
|
|
QlgStat() returned the following information about root f/s:
|
|
inode: 0
|
|
dev id: 1
|
|
mode: 010001ed
|
|
links: 3
|
|
uid: 137
|
|
gid: 500
|
|
</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>
|
|
|