C++: Delete a File

Bjarne-stroustrup
 

In this task, the job is to delete a file called “input.txt” and delete a directory called “docs”. This should be done twice: once “here”, i.e. in the current working directory and once in the filesystem root.

#include <cstdio>
#include <direct.h>

int main() {
	remove( "input.txt" );
	remove( "/input.txt" );
	_rmdir( "docs" );
	_rmdir( "/docs" );

	return 0;
}

SOURCE

Content is available under GNU Free Documentation License 1.2.