#include <fcntl.h> int unlink(const char *name);The synopsis for the POSIX implementation is
#include <sys/types.h> #include <unistd.h> int unlink(const char *name)
You may use either set of header files in your program.
unlink
function deletes the MVS disk file, PDS
member, or HFS file specified by the string that is pointed to by
name
.
Under CMS, unlink
deletes the disk file specified by the CMS
string that is pointed to by name
.
unlink
function returns 0 if the file is deleted. If the
file cannot be deleted or name
is invalid, - 1 is
returned.
For ddn
style filenames that do not refer to a PDS member, unlink
means "to make empty." Other style filenames are deleted and uncataloged.
CMS
If the fileid has a blank filemode, it defaults to A1
. The name
function should not contain wild-card values such as *
or =
.
POSIX
For an OpenEdition HFS file, the directory entry is deleted. However, the file itself is deleted only when there are no links that refer to it.
unlink
is an alternate name for remove
. See the
implementation details for remove
.
#include <fcntl.h> #include <stdio.h> main() { int rc; rc = unlink("cms:testfile text a1"); if (rc == 0) puts("The file has been unlinked/deleted."); else puts("The file could not be deleted."); }
link
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.