Setting group and owner of a file in obj-c
I am trying to change group and owner of a file in a cocoa application and was planning to use setAttributes:ofItemAtPat开发者_如何学运维h:error:
method of NSFileManager
However I was wondering how to get possible values for NSFileGroupOwnerAccountID
and NSFileOwnerAccountID
Thanks
If you know the name of the particular user or group, you can use getpwnam(3)
and getgrnam(3)
to obtain the corresponding ids.
If you want to iterate over the list of users or groups, you can use getpwent(3)
and getgrent(3)
.
精彩评论