LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mapping of uid and user (https://www.linuxquestions.org/questions/linux-newbie-8/mapping-of-uid-and-user-4175554100/)

pavan540 09-21-2015 01:04 PM

mapping of uid and user
 
i am trying to get the owner (name) of a file using stat() system call. But i am geting uid (uid_t) which is an integer value. How to get the username from that integer??

HMW 09-21-2015 01:43 PM

Try %U:
Code:

$ stat --format "%U" ls_uniq.sh
HMW

Code:

man stat
Best regards,
HMW

ntubski 09-21-2015 02:16 PM

Assuming you're talking about a C program, you can try getpwuid(3) to find a user name given a uid.


All times are GMT -5. The time now is 08:05 AM.