how to create a folder in C++

Started by
4 comments, last by jimywang 19 years, 6 months ago
this might be a stupid question.but I really wanna know how I can create and delete a folder in C++.thanks in advance. regards
Advertisement
It's platform-specific. mkpath for UNIX (look up the header), CreateFile for Windows.

Alternatively, you can cheat. Create a file using fstream and all the directories in the path will be created as well. Then use unlink to remove the file.
Hi,
If you're talking about creating and deleting a directory in the exterior OS, and that OS is windows, then CreateDirectory and RemoveDirectory and your friends - a search on MSDN will probably find them (if not, have a look in Petzold).

I am sorry I should of made it clear.all I want to do is create a empty folder in windows from a C++ program and delete it later on.what is the easiest way to do it?thanks in advance.
ofcourse, there is always the Boost::filesystem library ofcourse
thanks for all the help.I just got it working.

This topic is closed to new replies.

Advertisement