how to remove a entire directory in c++
That's Windows only though. You might as well just use `system("rmdir folder_name");`
Peter Alexander
2010-02-10 14:59:03
The question is tagged visual-studio-2005 and windows.
plinth
2010-02-10 14:59:47
The `windows` tag was added by someone else, maybe the OP is developing on VS but wants to stay multiplatform
Manuel
2010-02-10 15:03:44
Ah, I see and apologize. I still think portability should be maintained, even if not entirely necessary, providing it doesn't come at great expense.
Peter Alexander
2010-02-10 15:05:06
+11
A:
There isn't a standard way of manipulating the filesystem in C++, so you will have to use system specific code or use a wrapper around it. For example, Boost.Filesystem.
As you indicated you are using Windows you could use the Win32 API however it is a a C API rather than a C++ API which means it is slightly more complex to use from C++. As it is Windows specific it won't work on other operating systems. In my opinion the API is not as well designed as Boost.Filesystem.
Yacoby
2010-02-10 14:58:39
+1 Boost.Filesystem is a beautiful DSL for filesystem operations, and your code will be portable. Definitely go for it.
just somebody
2010-02-10 15:26:32