LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C fstat, st_uid and alphanumeric userID (https://www.linuxquestions.org/questions/programming-9/c-fstat-st_uid-and-alphanumeric-userid-490667/)

banan 10-08-2006 05:41 PM

C fstat, st_uid and alphanumeric userID
 
Hello everyone.
I have a problem. I need to compare the uid of a file with uid provided to me by a user. Problem is that when I use fstat and st_uid I get an integer (well, uid_t format) uid associated with alphanumeric userid and user is providing me with his alphanumeric userid.
Question: is there any way in C to get corresponding integer uid knowing alphanumeric one ore vice versa so I can compare them?
Thanks in advance.

randyding 10-08-2006 05:47 PM

Look at these funcitons.
getpwuid()
getpwnam()
getgrgid()
getgrnam()

banan 10-08-2006 06:17 PM

Quote:

Originally Posted by randyding
Look at these funcitons.
getpwuid()
getpwnam()
getgrgid()
getgrnam()

THANK YOU SO MUCH!
I have been looking for this functions for hours!!
getpwuid() works great. exactly what I needed!


All times are GMT -5. The time now is 09:14 PM.