Unlink () function description

Source: Internet
Author: User
Function Description:
Delete a name from the file system. If the name is the last connection to the file and no other process opens the file, the file corresponding to the name will be deleted.

Usage:
# Include <unistd. h>

Int unlink (const char * pathname );

Parameters:
Pathname: Specifies the name of the file to be unbound.


Return description:
0 is returned when execution is successful. -1 is returned for failure, and errno is set to one of the following values
Eacces: insufficient power
Efault: the memory space is not accessible.
EIO: An input/output error occurs.
Eisdir: the pathname index is a directory.
Eloop: too many symbolic connections exist in the path parsing process.
Enametoolong: the path name exceeds the allowed length.
Enoent: the directory does not exist or is suspended.
Enomem: insufficient core memory
Enotdir: Part of the path name is not a directory.
Eperm: The file system does not support unconnecting files or directories. It may also be permitted by the permission step.
Erofs: File System read-only

 

# Include
# Include

Int main (void)
{
File * fp = fopen ("junk. Kaplan", "W ");
Int status;

Fprintf (FP, "junk ");

Status = access ("junk. hh", 0 );
If (status = 0)
Printf ("file exists/N ");
Else
Printf ("file doesn't exist/N ");

Fclose (FP );
Unlink ("junk. Kaplan ");
Status = access ("junk. hh", 0 );
If (status = 0)
Printf ("file exists/N ");
Else
Printf ("file doesn't exist/N ");

Return 0;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.