How about this?
Use stat to get the UID for the file and then call getpwent to convert UID into a name:
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
struct passwd *userinfo;
struct stat buf;
char *filespec = "/usr/home/example";
stat(filespec, &buf);
userinfo =...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.