I use the code below to create directories, but it fails. What is the correct way to do it? Thanks in advance.
 try
    {
        string logdirname("./notexistdir/logdir/");
        boost::filesystem::path logdir(logdirname.c_str());
        boost::filesystem::file_status s = boost::filesystem::status(logdir);
        if( !boost::filesystem::is_directory(s) )
        {
            cout<< "not a directory, mkdir" <<endl;
            if(boost::filesystem::create_directory(logdir))
            {
                cout<<"directory create ok" <<endl;
            }
            else
            {
                cout<<"directory create fail" <<endl;
            }
        }
        else
        {
            cout<<"is a directory" <<endl;
        }
    }
    catch(exception& ex)
    {
        cout<< "exception caught[" << ex.what() <<"]" <<endl;
    }