QlgUnlink()--Remove Link to File (using NLS-enabled path name)


  Syntax
 #include <Qp0lstdi.h>

 int QlgUnlink(Qlg_Path_Name_T *Path_Name);  
  Service Program Name: QP0LLIB1

  Default Public Authority: *USE

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

The QlgUnlink() function, similar to the unlink() function, removes a directory entry that refers to a file. QlgUnlink()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 more information on the *Path_Name parameter and a discussion of the authorities required, return values, and related information, see unlink()--Remove Link to File.


Parameters

Path_Name
(Input) A pointer to a Qlg_Path_Name_T structure that contains a path name or a pointer to a path name of the object to be unlinked. For more information on the Qlg_Path_Name_T 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 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";

  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;
  pns.qlg_struct.Path_Name_Delimiter[0] = '/';
  memcpy(pns.pn,fn,sizeof(fn)-1);

  pns_ptr = &pns;

  if (QlgUnlink((Qlg_Path_Name_T *)&pns) != 0)
  {
      perror("QlgUnlink() error");
  }
  else printf("QlgUnlink() successful");
}

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