#include <sys/stat.h> int QlgStat(Qlg_Path_Name_T *path,struct stat *buf);Service Program Name: QP0LLIB1
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 on the path parameter is provided here. For more information on the path parameter and for a discussion of other parameters, authorities required, return values, and related information, see stat()--Get File Information.
See Code disclaimer information for information pertaining to code examples.
The following example gets status information about a file:
#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
| Top | UNIX-Type APIs | APIs by category |