|
发表于 2004-7-3 17:13:22
|
显示全部楼层
- #include <stdio.h>
- #include <sys/types.h>
- #include <grp.h>
- int
- main(int argc, char *argv[])
- {
- /*
- * to get the group name form argv[]
- * assume the group name is grpname;
- */
- char *grpname;
- struct group *agrp;
- char **p;
- agrp=getgrnam(grpname);
- p=agrp->gr_mem;
- while(*p != NULL)
- printf("%s\n",*p++);
- }
-
复制代码 |
|