Delete File


int main() {
	int status;
	status = remove("newfile.txt");

	/* Checking the file is deleted or not */
	if(status == 0)
		printf("File Deleted Successfully!\n");
	else {
		printf("Unable to delete the file!\n");

		/* Print descriptive error message to stderr */
	return 0;

File Deleted Successfully!


Unable to delete the file!

Error: No such file or directory

Learn more about File I/O in C

Recommended for you