我正在使用Boost库在Ubuntu环境下编写C++程序。我有一些问题不是很清楚:
fs::is_directory
namespace fs = boost::filesystem; fs::path full_path(fs::initial_path<fs::path>() ); full_path = fs::system_complete(fs::path( "temp/")); if(fs::is_directory(full_path )) { cout << "the path is a directory" << endl; } else { cout << "the path is not a directory" << endl; }
=> I am sure that the moment I am running the program, there is a directory temp at the same location with the executable file. But it is always returned: "the path is not a directory" ?
fs::last_write_time
Is this
fs::last_write_time(path)
be able to get the last date time of modifying for the given path for BOTH either a directory or a file?If it is true also for a directory, is that true for only the directory when it was created or the last date time if I add a file to inside the folder as well?
fs::directory_iterator
fs::directory_iterator dir(full_path)
=> how can I check whether this 'dir' has any sub directories or not?
Is there any way in boost::fileSystem to check if a file is opening?
提前感谢,希望您能帮助我澄清我的想法!
/tmp
是一个目录,但是temp/
是一个目录吗? - Benoit101010
按钮) - jalf