getuid to decode uid ?

This is a discussion on getuid to decode uid ? within the Linux Programming forums, part of the Platform Specific Boards category; I need to find out the owner of a file, i can get this as an int using st_uid of ...

  1. #1
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385

    getuid to decode uid ?

    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
    Monday - what a way to spend a seventh of your life

  2. #2
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    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
    Monday - what a way to spend a seventh of your life

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Encode and Decode algorith for 2 to 7 bits
    By kingofpop in forum C Programming
    Replies: 2
    Last Post: 11-15-2008, 06:08 AM
  2. getpwnam_r returns wrong uid.
    By stevfletchcom in forum C Programming
    Replies: 5
    Last Post: 10-22-2008, 04:59 PM
  3. username to uid
    By chrismiceli in forum Linux Programming
    Replies: 1
    Last Post: 07-30-2007, 01:23 PM
  4. decode data and screen refresh
    By jérèm in forum C Programming
    Replies: 3
    Last Post: 12-16-2005, 01:43 AM
  5. username to uid mapping
    By rotis23 in forum C Programming
    Replies: 1
    Last Post: 10-30-2002, 03:17 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21