我想知道unix命令组是否有其他C库,$ groups ---- lists all the group id's of the user.
有一个名为getgroups()的方法,但此方法将返回用户组。有没有一种方法可以使用C为特定用户获取组。
最佳答案
#include "<grp.h>"
int getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups);
关于c - 使用C在Linux中获取用户组的正确方法,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22104383/