Name

wunlink - delete a name and possibly the file it refers to

Library

libc.lib

Synopsis

  #include <wchar.h>
  int wunlink (const wchar_t *path);

Return values

Upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned and errno set to indicate the error.

Detailed description

The wunlink system call removes the link named by path from its file system. It is expected to decrement the link count of the file which was referenced by the link, but since this is a simulated function and not supported by the platform, link count does not get modified. As the parent file to which a link is created itself is unaware about the link, a wunlink on the parent file will close the file regardless of weather there existed any link to the file. The path argument may not be a directory.

Examples

/*
* Detailed description: Example to wunlink a link file
* Precondition: A file by name "Link" should exist in
*                c: drive.
*/
#include <wchar.h>
#include <stdio.h>
int main(void)
{
    if(wunlink(L"C:\\Link"))
    {
         printf("wunlink on link file failed");
    }
    printf("wunlink on link file succeeded");
}

         

Output

wunlink on link file succeeded.

         

Errors

The wunlink succeeds unless:
[ENOENT]
  The named file does not exist.
[EINVAL]
  A relative path was encountered in translating path and is not supported by the platform.
[ENOENT]
  An empty path was encountered while translating the pathname.
[EINVAL]
  File mentioned in the path is open.

Errors

The function wunlink may fail to update the timestamp of the parent directory.

See also

close, rmdir

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top