QlgStat64()--Get File Information (large file enabled and using NLS-enabled path name)


  Syntax
 #include <sys/stat.h>

 int QlgStat64(Qlg_Path_Name_T *path, struct stat64 *buf);  
  Service Program Name: QP0LLIB1

  Default Public Authority: *USE

  Threadsafe: Conditional; see Usage Notes for stat64().

The QlgStat64() 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 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 stat64()--Get File Information (Large File Enabled).


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


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.

#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

API introduced: V5R1

[ Back to top | UNIX-Type APIs | APIs by category ]