How to create a folder on a Mac with C++?

前端 未结 2 500
伪装坚强ぢ
伪装坚强ぢ 2021-01-24 13:33

How do you have the user input the folder name and have it created in the desktop (for mac)? This is what I have so far.. (and extra code underneath)

#include &         


        
相关标签:
2条回答
  • 2021-01-24 13:54

    Environment variables are case sensitive, so you need to use getenv("HOME") instead of getenv("Home").

    0 讨论(0)
  • 2021-01-24 13:55

    Use Boost Library (though there will be overhead of setting up boost on your system but its worth for doing many other stuffs in C++): boost::filesystem::create_directories()

    #include <boost/filesystem.hpp>
    
    // your code....
    
    boost::filesystem::create_directories("/bla/a");
    
    0 讨论(0)
提交回复
热议问题