to obtain users of each group in c

Hello
They have ordered to me that makes several small utilities in C/C++ for the servants, among them a small program in C/C++ to generate a file HTML with the groups of that servant and in addition that is the corresponding users of that group.
For example of a group:
Group: Sys Members: root, bin, Sys, adm....
and that all the groups.
And not like doing it, to know the groups it is only question to read the /etc/group file, but nonencounter the form to know the members each group. That analogous functions to getpwent exist, setpwent... for groups, but encounter any information does not exceed they. Which use to make or another small program that generates a HTML with the data of all the users, but they do not serve me for this work in particular, or at least not like.
Thanks.

I think what you are looking for is the getgrent() function.

thanks,