I want to delete all .txt
files in the folder where the executable is located when the program closes.
To delete the files I use system("del /s *.txt");
, but I want to do it when the program closes so I've made a void function
void deleteTxt() {
system("del /s *.txt");
}
and I've added the line atexit(deleteTxt());
in the main
function, but compiler gives the error: "void" incompatible with "void (__cdecl *)()"
What can I do? Thanks and have a good day.