QlgStat()--Get File Information (using NLS-enabled path name)
Syntax
#include <sys/stat.h> int QlgStat(Qlg_Path_Name_T *path,struct stat *buf);Service Program Name: QP0LLIB1
Default Public Authority: *USE
Threadsafe: Conditional; see Usage Notes for stat().
The QlgStat() function, like the stat() function, gets status information about a specified file and places it in the area of memory pointed to by the buf argument. The difference is that the QlgStat() function takes a pointer to a Qlg_Path_Name_T structure, while stat() takes a pointer to a character string.
Limited information about the path parameter is provided here. For more information about the path parameter and for a discussion of other parameters, authorities required, return values, and related information, see stat()--Get File Information.
Parameters
- path
- (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 about the Qlg_Path_Name_T structure, see Path name format.
Related Information
- stat()--Get File Information
- QlgStat64()--Get File Information (large file enabled and using NLS-enabled path name)
- QlgChmod()--Change File Authorizations (using NLS-enabled path name)
- QlgChown()--Change Owner and Group of File (using NLS-enabled path name)
- QlgCreat()--Create or Rewrite File (using NLS-enabled path name)
- QlgLink()--Create Link to File (using NLS-enabled path name)
- QlgLstat()--Get File or Link Information (using NLS-enabled path name)
- QlgMkdir()--Make Directory (using NLS-enabled path name)
- QlgReadlink()--Read Value of Symbolic Link (using NLS-enabled path name)
- QlgSymlink()--Make Symbolic Link (using NLS-enabled path name)
- QlgUtime()--Set File Access and Modification Times (using NLS-enabled path name)
- Qp0lUnlink()--Remove Link to File
Example
The following example gets status information about a file.
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
#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);
}
}
Output: note that the following information will vary from system to system.
QlgStat() returned the following information about root f/s:
inode: 0
dev id: 1
mode: 010001ed
links: 3
uid: 137
gid: 500
API introduced: V5R1