HI,
On Sat, Jul 11, 2009 at 7:45 AM, Mulyadi Santosa <mulyadi.sant...@gmail.com>wrote: > Hi... > > On Fri, Jul 10, 2009 at 11:35 PM, SandeepKsinha<sandeepksi...@gmail.com> > wrote: > > > > > > On Thu, Jul 9, 2009 at 11:45 PM, Adrian Cornish <adri...@cqg.com> wrote: > >> > >> Is there any inbuilt( ) c function which can validate if the passed > >> uid/gid exist's on the machine or not? > >> How about:- > >> struct passwd *getpwuid(uid_t uid); > > > > Thanks, but any for validating the gid ???? > > I think one of the way to do that is by calling getpwent() several > times until it returns NULL (meaning it hits the last record of > /etc/passwd). getpwent() returns passwd struct and gid is in there. > > What do you think? man getpwent for further info... > Thanks. That woked out for me. Also, getgroups( ) worked in a similar manner for me. > > -- > regards, > > Mulyadi Santosa > Freelance Linux trainer > blog: the-hydra.blogspot.com > -- Regards, Sandeep. “To learn is to change. Education is a process that changes the learner.”