getuid to decode uid ? [Archive] - C Board

PDA

View Full Version : getuid to decode uid ?


iain
11-27-2002, 10:06 AM
I need to find out the owner of a file, i can get this as an int using st_uid of the stat struct, this int isnt greatly useful though, how do i get the 'real' user id. Is it the function getuid(), if so how di i actually use this function.

i tried passing it the value from the struct

getuid(statStruct.st-uid)
but this doesnt work. Any info appreciated!
tia

iain
11-27-2002, 03:36 PM
sorry, didint make myself clear, i want to return the user name of the file owner.

Eg, my code for getting the st_uid from the struct stat returned 6749, how do i get the username (eg i-baughe) from that value