How to delete a folder in C++?


Question

How can I delete a folder using C++?

If no cross-platform way exists, then how to do it for the most-popular OSes - Windows, Linux, Mac, iOS, Android? Would a POSIX solution work for all of them?

1
37
12/22/2014 2:12:01 PM

I strongly advise to use Boost.FileSystem.

http://www.boost.org/doc/libs/1_38_0/libs/filesystem/doc/index.htm

In your case that would be

boost::filesystem::remove_all(yourPath)

59
3/19/2014 5:57:08 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon