C Best way to map a group name to group ID (ditto for user name to UID)?

Given a group name, like 'wheel' or 'operator', I want to retrieve the associated group ID. Ideally this would be independent of PAM. Seems like there should be some libc function that already does this. I can parse /etc/group but I'm hoping something exists already.

Edit: I just found "/usr/include/grp.h" and "/usr/include/pwd.h"
 
Back
Top