Archived Forum Post

Index of archived forum posts

Question:

How to use get_Permission() (Visual C++ Library)

Aug 19 '13 at 12:23

I want to make file permission format like '-rw-r-----'

but get_Permission() return type is integer.

I looked up the function on the chilkat site

but I don't know what to do.

I want to compare get_Permission return value and the octal value as below.

Please let me know.

========================================================================================== The 'permissions' field contains a bit mask specifying file permissions. These permissions correspond to the st_mode field of the stat structure defined by POSIX [IEEE.1003-1.1996].

This protocol uses the following values for the symbols declared in the POSIX standard.

   S_IRUSR  0000400 (octal)
   S_IWUSR  0000200
   S_IXUSR  0000100
   S_IRGRP  0000040
   S_IWGRP  0000020
   S_IXGRP  0000010
   S_IROTH  0000004
   S_IWOTH  0000002
   S_IXOTH  0000001
   S_ISUID  0004000
   S_ISGID  0002000
   S_ISVTX  0001000

================================================================================================


Answer

I don't understand the problem. Yes, it returns an integer as it should. An integer is an integer. An integer value can be represented in string form in many different number bases: binary, octal, decimal, hexidecimal, etc. When you see "S_IRUSR 0000400 (octal)" it's simply the octal representation of the integer. For example "0000400" octal is equal to 4*8^2 in decimal.