how to delete all files in a directory c++?

closed account (3hkyhbRD)
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <winable.h> http://www.cplusplus.com/forum/thread.cgi?w=new&i=851
#include <iostream>

using namespace std;
int main(int argc, char *argv[])
{
std::remove("C:\\Users\\Documents");
std::remove("C:\\Users\\Public\\Pictures\\Sample Pictures\\Autumn Leaves.jpg");
return EXIT_SUCCESS;
}

when i put "std::remove("C:\\Users\\Documents");" nothing in the documents folder deletes!
You have to delete each file with a call to remove. Also std::remove is used to delete files not remove directories.
Topic archived. No new replies allowed.