company logo

FileHandle :: ChangeAccess - Change file attributes

The function changes the access mode or rights (file attributes) of a file. The function operates with the file name passed in cpath regardless whether the file is currently open in the FileHandle or not.

The Modes that can be set are equivalent with the fil::AccessModes ( sos ). Access modes have to be passed either as enumeration value or as string value containing exact enumerator names.

FileHandle DocFile;

DocFile.ChangeAccess("/tmp/executablescript","ACC_All","ACC_ReadExecute","ACC_ReadExecute");

Return value:  Return value ( logical  )

The function returns YES when the question was answered positively. Otherwise it returns NO .

Implementation details

logical FileHandle  :: ChangeAccess ( NPath &cpath, AccessMode owner_accmode, AccessMode group_accmode, AccessMode other_accmode )

The function is usually called from within C++ functions that got access to SOS project library, which provides the access right enumeration ( AccessMode ). When this is not the case or when calling the function from within OSI functions, the STRING implementation should be called

FileHandle DocFile;

DocFile.ChangeAccess("/tmp/executablescript",ACC_All,ACC_ReadExecute,ACC_ReadExecute);

  • cpath - Complete file or directory path
  • owner_accmode - Access rights for file owner
  • group_accmode - Access rights for group users
  • other_accmode - Access rights for others