QlgCreat64()--Create or Rewrite a File (large file enabled and using NLS-enabled path name)


  Syntax
 #include <fcntl.h>

 int QlgCreat64(Qlg_Path_Name_T *path,mode_t mode);  
  Service Program Name: QP0LLIB1

  Default Public Authority: *USE

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

The QlgCreat64() function, like the creat64() function, creates a new file or rewrites an existing file so that it is truncated to zero length. The difference is that the QlgCreat64() function takes a pointer to a Qlg_Path_Name_T structure, while creat64() takes a pointer to a character string. See creat64()--Create or Rewrite a File (Large File Enabled) and open64()--Open File (Large File Enabled) for more details on how the function call

     QlgCreat64(path,mode);
is equivalent to the call
    QlgOpen64(path, O_CREAT|O_WRONLY|O_TRUNC, mode);

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 creat64()--Create or Rewrite a File (Large File Enabled) or open64()--Open File (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 to be created or rewritten. For more information about the Qlg_Path_Name_T structure, see Path name format.

Related Information


Example

The following example creates 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 <stdio.h>
#include <fcntl.h>
#include <Qp0lstdi.h>

main()
{
  char text[]="This is a test";
  int fd;
#define mypath "creat.file"
  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)-1);

  if
   ((fd =
   QlgCreat64(
        (Qlg_Path_Name_T *)&path, S_IRUSR | S_IWUSR))
    < 0)
   {
    perror("QlgCreat64() error");
   }
  else {
    write(fd, text, strlen(text));
    close(fd);
    QlgUnlink((Qlg_Path_Name_T *)&path);
  }
}

API introduced: V5R1

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