QlgLstat64_time64()--Get File or Link Information (large file and time64_t enabled and using NLS-enabled path name)
Syntax
#include <sys/stat.h> int QlgLstat64_time64(Qlg_Path_Name_T *path, struct stat64_time64 *buf);Service Program Name: QP0LLIB1
Default Public Authority: *USE
Threadsafe: Conditional; see Usage Notes for lstat().
The QlgLstat64_time64() function, like the lstat64_time64() function, gets status information about a specified file and places it in the area of memory pointed to by buf. The difference is that the QlgLstat64_time64() function takes a pointer to a Qlg_Path_Name_T structure, while lstat64_time64() 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 lstat64_time64()--Get File or Link Information (large file and time64_t enabled) or lstat()--Get File or Link 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. For more information about the Qlg_Path_Name_T structure, see Path name format.
Related Information
- lstat()--Get File or Link Information (using NLS-enabled path name)
- lstat64()--Get File or Link Information (large file enabled)
- QlgLstat64()--Get File or Link Information (large file enabled and using NLS-enabled path name)
Example
The following example provides status information for a file.
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
#define _LARGE_FILE_API #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <time.h> #include <Qp0lstdi.h> main() { struct stat64_time64 info; int file_descriptor; #define mypath_fn "temp.file" #define mypath_ln "temp.link" 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_fn; struct pnstruct path_ln; /***************************************************************/ /* Initialize Qlg_Path_Name_T parameters */ /***************************************************************/ memset((void*)&path_fn, 0x00, sizeof(struct pnstruct)); path_fn.qlg_struct.CCSID = 37; memcpy(path_fn.qlg_struct.Country_ID,US_const,2); memcpy(path_fn.qlg_struct.Language_ID,Language_const,3); path_fn.qlg_struct.Path_Type = QLG_CHAR_SINGLE; path_fn.qlg_struct.Path_Length = sizeof(mypath_fn)-1; path_fn.qlg_struct.Path_Name_Delimiter[0] = '/'; memcpy(path_fn.pn,mypath_fn,sizeof(mypath_fn)-); memset((void*)&path_ln, 0x00, sizeof(struct pnstruct)); path_ln.qlg_struct.CCSID = 37; memcpy(path_ln.qlg_struct.Country_ID,US_const,2); memcpy(path_ln.qlg_struct.Language_ID,Language_const,3); path_ln.qlg_struct.Path_Type = QLG_CHAR_SINGLE; path_ln.qlg_struct.Path_Length = sizeof(mypath_ln)-1; path_ln.qlg_struct.Path_Name_Delimiter[0] = '/'; memcpy(path_ln.pn,mypath_ln,sizeof(mypath_ln)-); if ((file_descriptor = QlgCreat64((Qlg_Path_Name_T *)&path_fn, S_IWUSR)) < perror("QlgCreat64() error"); else { close(file_descriptor); if (QlgLink((Qlg_Path_Name_T *)&path_fn, (Qlg_Path_Name_T *)&path_ln) != 0) perror("QlgLink() error"); else { if (QlgLstat64_time64((Qlg_Path_Name_T *)&path_ln, &info) != 0) perror("QlgLstat64_time64() error"); else { puts("QlgLstat64_time64() returned:"); 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); printf(" size: %lld\n", (long long) info.st_size); } QlgUnlink((Qlg_Path_Name_T *)&path_ln); } QlgUnlink((Qlg_Path_Name_T *)&path_fn); } }
Output:
QlgLstat64_time64() returned: inode: 258 dev id: 1 mode: 00008080 links: 2 uid: 137 gid: 500 size: 18
API introduced: IBM® i 7.2