-
Creating Folders
I want to create a folder, and I am unsure how to do this. I want to place all the files from a program in this folder. Also, if I have an uninstall type of thing for one of my programs, how would I got about deleting the folder? I had found something looking like the code below, but I am unsure if this works or not...Any help is greatly needed and appreciated.
Code:
system("rmdir C:\\Directory");
Thanks in advance for all help! :)
-
In dir.h (if your compiler has it) you'll find a lot of directory related functions - chdir,rmdir,getcurdir etc
If you tell us about your compiler/os then people here might help you better. I'm assuming Borland/Windows-Dos
that will work and remove the direectory if it is empty i think. But that is slow.
-
Alright, I will have to check out that dir.h. Now, you had said that the way I knew to delete folders was slow. Do you mean REALLY slow? Is there a faster (and relatively simple ;) ) way to do it? Please, any help is appreciated.
-
I haven't used system() but everyone says that it is slow. Wether it is 'slow' by computer std or by normal std is something i cant really tell you much about.
I use the following method to delete folders:
1. Use the findfirst() and findnext() to see the file contents of that dir.
2. If files are present then use remove() to delete them
3. Then use rmdir() to delete the folder.
But all the 3 functions are in dir.h except remove which is in stdio
I dont think it tells if there are sub-dirs in there too.
-
I was planning on deleting each file in the folder (as they will most likely all be created by my program), then removing the program. I tried out the system thing way of deleting the folder, and it seemed okay to me. But thank you for your help ihsir. Oh, and you can check out my program that I am talking about at the link below. It isn't finished, but it is playable and the source and library are there.