Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/u/unlink.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/u/unlink.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/u/unlink.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/u/unlink.html on line 8

unlink()

Remove a link to a file

Synopsis:

#include <unistd.h>

int unlink( const char * path );

Arguments:

path
The name of the file that you want to unlink.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The unlink() function removes a link to a file:


Note: To remove a directory, call rmdir() or remove().

Returns:

0
The operation was successful.
Nonzero
The operation failed (errno is set).

Errors:

EACCES
Search permission is denied for a component of path, or write permission is denied on the directory containing the link to be removed.
EBUSY
The directory named by path cannot be unlinked because it's being used by the system or another process, and the target filesystem or resource manager considers this to be an error.
ENAMETOOLONG
The path argument exceeds PATH_MAX in length, or a pathname component is longer than NAME_MAX.
ENOENT
The named file doesn't exist, or path is an empty string.
ENOSYS
The unlink() function isn't implemented for the filesystem specified by path.
ENOTDIR
A component of path isn't a directory.
EPERM
The file named by path is a directory, and either the calling process doesn't have the appropriate privileges, or the target filesystem or resource manager prohibits using unlink() on directories.
EROFS
The directory entry to be unlinked resides on a read-only filesystem.

Examples:

#include <unistd.h>
#include <stdlib.h>

int main( void )
{
    if( unlink( "vm.tmp" ) ) {
        puts( "Error removing vm.tmp!" );
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}

Classification:

POSIX 1003.1

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

chdir(), chmod(), close(), errno, getcwd(), link(), mkdir(), open(), pathmgr_symlink(), pathmgr_unlink(), remove(), rename(), rmdir(), stat(), symlink()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/u/unlink.html on line 233

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/u/unlink.html on line 233