Qp0lUnlink()--Remove Link to File


  Syntax
 #include <Qp0lstdi.h>

 int Qp0lUnlink(Qlg_Path_Name_T *path_name);  

  Service Program Name: QP0LLIB1

  Default Public Authority: *USE

  Threadsafe: Conditional; see Usage Notes on open() API.  

The Qp0lUnlink() function, similar to the unlink() function, removes a directory entry that refers to a file. Qp0lUnlink() differs from unlink() in that the path_name parameter is a pointer to a Qlg_Path_Name_T structure instead of a pointer to a character string.

For a discussion of the authorities required, return values, and related information, see unlink()--Remove Link to File.


Parameters

Path_Name
(Input) The path name of the object to be unlinked. This path name is in the Qlg_Path_Name_T format. For more information on this structure, see Path Name Format.

Related Information


Example

See Code disclaimer information for information pertaining to code examples.

The following example removes a link to a file: This program was stored in a source file with CCSID 37, so the constant string "newfile" will be compiled in coded character set identifier (CCSID) 37. Therefore, the country or region and language specified are United States English, and the CCSID specified is 37.

#include <fcntl.h>
#include <stdio.h>
#include <Qp0lstdi.h>

main() {
  const char US_const[3]= "US";
  const char Language_const[4]="ENU";
  const char Path_Name_Del_const[2] = "/";

  struct pnstruct
    {
     Qlg_Path_Name_T  qlg_struct;
     char             pn[7];
    };
  struct pnstruct pns;
  struct pnstruct *pns_ptr = NULL;

  char fn[]="unlink.file";

  memset((void*)&pns, 0x00, sizeof(struct pnstruct));
  pns.qlg_struct.CCSID = 37;
  memcpy(pns.qlg_struct.Country_ID,US_const,2);
  memcpy(pns.qlg_struct.Language_ID,Language_const,3);;
  pns.qlg_struct.Path_Type = 0;
  pns.qlg_struct.Path_Length = sizeof(fn)-1;
  memcpy(pns.qlg_struct.Path_Name_Delimiter,
         Path_Name_Del_const,1);
  memcpy(pns.pn,fn,sizeof(fn));
  memset((void *)&Attr_types_ptr, 0x00,
         sizeof(struct attrStruct));
  pns_ptr = &pns;

  if (Qp0lUnlink((Qlg_Path_Name_T *)&pns) != 0)
      perror("Qp0lunlink() error");
}


API introduced: V4R4
Top | UNIX-Type APIs | APIs by category