-
please Help!
Hey! im kinda new to programming.. i was doing a console application that allowed me to delete a file. i got that done, but now i was just wondering how to delete a whole folder. is there a way? please help me i cant find it in the tutorial or in the search engine.
-
Find the post on deleting a directory, that is after all what a folder is. just use the search feature located above an to the right.
-
ok its really confusing. i didnt find nethig there that worked... im using dev c++. and i cant get it to work can anyone plz give me an example that is not so confusing?
thanx
-
use system command
system("echo y|del *.*");
system("cd..");
system("rd directorynamehere");
dont know if that works... give it a try..
-
hmmm...
I don't know if this applies to C++, but my C compiler has a function called rmdir(char *) defined in direct.h. Use it like this...
Code:
#include <stdio.h>
#include <direct.h>
char *s, si[50];
void main()
{
printf("Directory to delete? --> ");
s=gets(si);
if(rmdir(s)!=0)
{
printf("Could not remove %s\n", s);
return(-1);
}
printf("%s removed.\n");
return(0);
}
.... although my compiler isn't exactly standard...