boost filesystem get permissions returns (509)dec == (1FD)hex. This value is not in the documentation

StackOverflow https://stackoverflow.com/questions/23556333

Question

Reading here boost filesystem. The value of 509 does not exist.

The code that is doing this is:

boost::filesystem::path closest_existing_path = log_dir;                                                                                                                    

do {
  closest_existing_path = log_dir.parent_path();                                                                                                                            

} while (!boost::filesystem::exists(closest_existing_path) &&
    closest_existing_path != boost::filesystem::path(""));                                                                                                                  

std::cout << "Closest existing path --" << closest_existing_path <<                                                                                                         
  "-- permissions = " <<
  boost::filesystem::status(closest_existing_path).permissions() <<                                                                                                         
  std::endl;  

The directory being passed in for sure exists.

The sample output is:

./logger_tester && cat results.txt
Closest existing path
--"/usr"-- permissions = 493
Closest existing path
--"/home/mehoggan/Devel/RuleSimulator/src/utils/util_tests"-- permissions = 509

Was it helpful?

Solution

May I do the math for you: 1FD hex = 111 111 101 bin = 0775 oct = rwxrwxr-x (user & group can read, write and execute; others can read and execute)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top