remove()Prototype: int remove(const char *filename);Header File: stdio.h (C) or cstdio (C++) Explanation: Remove will erase a file specified by filename. Upon success it will return zero, upon failure it will return nonzero. Example:
//Example will erase useless.txt, in the current directory
//It is recommend that useless.txt be...useless
#include <cstdio>
using namespace std;
int main()
{
if ( !remove("useless.txt") )
{
cout<<"Successful deletion";
}
else
{
cout<<"Oops, file not deleted (is it there?)";
}
}
Other Functions
|