#include <sys/stat.h> int QlgStat64(Qlg_Path_Name_T *path, struct stat64 *buf);Service Program Name: QP0LLIB1
TheQlgStat64() function, like the stat64() 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 QlgStat64() function takes a pointer to a Qlg_Path_Name_T structure, while stat64() 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 stat64()--Get File Information (Large File Enabled).
See Code disclaimer information for information pertaining to code examples.
The following example gets status information about a file:
#define _LARGE_FILE_API #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <time.h> main() { struct stat64 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 this 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)); if (QlgStat64((Qlg_Path_Name_T *)&path, &info) != 0) perror("QlgStat64() error"); else { puts("QlgStat64() 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.
QlgStat64() 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 |