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.

Ideas?

Thanks!

Recommended Answers

man fstat. Study the st_mode field.

Jump to Post

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.