My original plan was to pipe "ls -l", get the permission string that represented the file in question. Translate the string of 'r's 'w's 'x's '-'s into 0s and 1s then convert it from binary to octal.

This seems really cumbersome and annoying and I gotta figure there is some faster way. Even getting a string representation of the octal value would be great. I'm working in C on a linux environment btw.



Recommended Answers

All 2 Replies

man fstat. Study the st_mode field.

sweet thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.