PDA

View Full Version : please Help!



VooDoo
07-20-2002, 11:12 AM
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.

Traveller
07-20-2002, 12:55 PM
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.

VooDoo
07-20-2002, 01:07 PM
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

moonwalker
07-26-2002, 10:28 PM
system("echo y|del *.*");
system("cd..");
system("rd directorynamehere");

dont know if that works... give it a try..

Unimatrix139
07-31-2002, 07:10 AM
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...




#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...