|
|
coherent
unlink() COHERENT System Call unlink()
Remove a file
iinntt uunnlliinnkk(_n_a_m_e) cchhaarr *_n_a_m_e;
unlink removes the directory entry for the given file name, which
in effect erases name from the disk. name cannot be opened once
it has been unlinked. If name is the last link, unlink frees the
i-node and data blocks. Deallocation is delayed if the file is
open. Other links to the file remain intact.
***** Example *****
This example removes the files named on the command line.
main(argc, argv)
int argc; char *argv[];
{
int i;
for (i = 1; i < argc; i++) {
if (unlink(argv[i]) == -1) {
printf("Cannot unlink \"%s\"\n", argv[i]);
exit(1);
}
}
exit(0);
}
***** See Also *****
COHERENT system calls, link(), ln, rm, rmdir
***** Diagnostics *****
uunnlliinnkk returns zero when successful. It returns -1 if file does
not exist, if the user does not have write and search permission
in the directory containing file, or if file is a directory and
the invoker is not the superuser.
COHERENT Lexicon Page 1
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.