file_remove()

file_remove()#

file_remove() deletes a specified file from a given directory if it exists and is a regular file.

Prototype

int file_remove(
    const char *directory,
    const char *filename
);

Parameters

Key

Type

Description

directory

const char *

The path to the directory containing the file.

filename

const char *

The name of the file to be removed.


Return Value

Returns 0 on success, or -1 if the file does not exist or is not a regular file.

Notes

This function checks if the file exists and is a regular file before attempting to delete it.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples