Thread: please Help!

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    23

    Question 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.
    |:|::...<<VooDoo>>...::|:|

  2. #2
    Registered User
    Join Date
    May 2002
    Posts
    317
    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.

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    23
    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
    Last edited by VooDoo; 07-20-2002 at 01:25 PM.

  4. #4
    Registered User moonwalker's Avatar
    Join Date
    Jul 2002
    Posts
    282

    use system command

    system("echo y|del *.*");
    system("cd..");
    system("rd directorynamehere");

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

  5. #5
    Registered User Unimatrix139's Avatar
    Join Date
    Jun 2002
    Posts
    55

    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...
    Kree'ta Tau'ri! Chaapa'ai!

Popular pages Recent additions subscribe to a feed