Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
680 views
in Technique[技术] by (71.8m points)

visual studio 2008 - mkdir c++ function

I need to use the mkdir c++ function in VS 2008 which takes two arguments and is deprecated from VS 2005.

However this function is used in our code and I need to write a standalone product (containing only mkdir function) to debug something.

What header files do I need to import? I used direct.h, however compiler complains that the argument does not take 2 arguments (reason for this is the function was deprecated in VS 2005).

mkdir("C:hello",0);
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to write cross-platform code, you can use boost::filesystem routines

#include <boost/filesystem.hpp>
boost::filesystem::create_directory("dirname");

This does add a library dependency but chances are you are going to use other filesystem routines as well and boost::filesystem has some great interfaces for that.

If you only need to make a new directory and if you are only going to use VS 2008, you can use _mkdir() as others have noted.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...