How to create a folder in the home directory?
问题 I want to create a directory path = "$HOME/somedir" . I've tried using boost::filesystem::create_directory(path) , but it fails - apparently the function doesn't expand system variables. How can I do it the simplest way? (note: in my case the string path is constant and I don't know for sure if it contains a variable) edit: I'm working on Linux (although I'm planning to port my app to Windows in the near future). 回答1: Use getenv to get environment variables, including HOME . If you don't know