0

I am trying to convert a file type/permissions to a number, for example:

-rw-r--r-- 1 user user 741 Mar 10 15:40 test.js

I know how to convert the permissions "rw-r--r--" to a number, but I am stuck as to how to convert the file type "-" also?

I am trying to set the st_mode in the FUSE getattr method and I need this number from the string. I'm not sure how to combine the type and the permissions together into 1 number so I can set the mode in FUSE. Thanks, also I am using fuse4js.

kyle
  • 197
  • 1
  • 2
  • 11
  • when I was talking about "-", I was referring to to the first character, like "d" is a directory. I'm not sure how to combine these with the file permissions to create the file mode number (mode_t). – kyle Mar 23 '15 at 15:03

1 Answers1

0

This seems to be the masks for the file modes http://man7.org/linux/man-pages/man2/stat.2.html

kyle
  • 197
  • 1
  • 2
  • 11