FpUnlink function
Unlink (i.e. remove) a file.
Declaration
function FpUnlink(path: PAnsiChar): cintDescription
FpUnlink decreases the link count on file
Path.
Path can be
of type
AnsiString or
PChar. If the link count is zero, the
file is removed from the disk.
The function returns zero if the call was successful, a nonzero value indicates failure.
Note: There exist a portable alternative to erase files: system.erase. Please use fpUnlink only if you are writing Unix specific code. System.erase will work on all operating systems.
For an example, see FpLink.
Errors
Extended error information can be retrieved using fpGetErrno.
- sys_eaccess
- You have no write access right in the directory containing
Path, or you have no search permission in one of the directory components ofPath. - sys_eperm
- The directory containing pathname has the sticky-bit set and the process's effective uid is neither the uid of the file to be deleted nor that of the directory containing it.
- sys_enoent
- A component of the path doesn't exist.
- sys_enotdir
- A directory component of the path is not a directory.
- sys_eisdir
-
Pathrefers to a directory. - sys_enomem
- Insufficient kernel memory.
- sys_erofs
-
Pathis on a read-only file system.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
