c++ remove text file
#include <iostream>
#include <cstdio>
int main() {
const char* filename = "example.txt";
// Check if the file exists
if (std::remove(filename) != 0) {
std::perror("Error deleting the file");
return 1;
}
std::cout << "File deleted successfully." << std::endl;
return 0;
}