DEV/DEV1.1/TP11/groupe.c

38 lines
618 B
C

#include <stdio.h>
#include <stdlib.h>
#include <grp.h>
#include <sys/types.h>
int main(int argc, char const *argv[])
{
struct group *grp;
char grpname[]="senart22", **curr;
/*
if ((grp= getgrnam(grpname))== NULL)
printf("pas de groupe a ce nom");
else
{
printf("Membre du groupe %s : \n", grpname);
for (curr=grp->gr_mem; (*curr) != NULL; curr++)
printf(" %s\n", *curr);
}*/
struct group etu;
etu=*getgrname("senart22");
int i=0;
while(*etu.gr_name[i]!=NULL)
{
for (int j = 0; j < sizeof(etu.gr_name[i]); ++j)
{
printf("%s",etu.gr_name[i][j]);
}
printf("\n");
}
return 0;
}