For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > September 2004 > Get Unix Groups









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Get Unix Groups
Kushal Agarwal

2004-09-29, 8:07 pm

Hello,

I am wondering what is the system call to get all the groups a user
belongs to. I need both the group ids and the group names. I need to
make this call from a c++ module.

Thanks,

Kushal
Dragan Cvetkovic

2004-09-29, 8:07 pm

kushal.agarwal@gmail.com (Kushal Agarwal) writes:

> Hello,
>
> I am wondering what is the system call to get all the groups a user
> belongs to. I need both the group ids and the group names. I need to
> make this call from a c++ module.


getgroups() followed by getgrgid() for each of these.

At least on Solaris (you didn't specify the platform).

And please learn to crosspost instead of multipost.

And have a nice day.

Dragan

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer

!!! Sender/From address is bogus. Use reply-to one !!!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com