Deletes the file whose name is specified in filename.
This is an operation performed directly on a file identified by its filename; No streams are involved in the operation.
Proper file access shall be available.
Parameters
filename
C string containing the name of the file to be deleted.
Its value shall follow the file name specifications of the running environment and can include a path (if supported by the system).
Return value
If the file is successfully deleted, a zero value is returned.
On failure, a nonzero value is returned.
On most library implementations, the errno variable is also set to a system-specific error code on failure.
If the file myfile.txt exists before the execution and the program has write access to it, the file would be deleted and this message would be written to stdout:
File successfully deleted
Otherwise, a message similar to this would be written to stderr: