C ++: boost / filesystem: some questions

I am using the C ++ Boost library running in the Ubuntu environment. I have some questions that I don't understand about:

  • 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 at the moment when I run the program, there is a temporary directory folder in the same place with the executable file. But he always returns: "path is not a directory"?

  • fs::last_write_time

    • Could this fs::last_write_time(path)get the last time to change for a given path for BOTH either a directory or a file?

    • If this is true for the directory, is it only true for the directory when it was created, or for the last time of the date if I add a file inside the folder?

  • fs::directory_iterator

    • fs::directory_iterator dir(full_path) => how can I check if this 'dir' has any auxiliary directories or not?
  • Is there a way in boost :: fileSystem to check if a file is opening?

, , !

+3
2
  • , . cout << fullpath , , , , , ?

  • last_write_time. .

  • fs::is_directory(dir->status()), , . (, dir )

  • , boost:: filesystem , .

+2

re 4: , , [boost::filesystem|std]::fstream::is_open()?

0

Source: https://habr.com/ru/post/1775396/


All Articles