fengyuganyu 发表于 2010-10-15 20:01:44

求助:linux C 中怎么获得文件所有者的名 是名 ,不是uid

如题,最近学习linux C 现在想获取文件所有者的名 和 组名怎么获得呀,用stat() 只能获得它的uid 和 gid,

求助前辈们指点!

在线等。。。。

ywhbn 发表于 2010-10-15 21:13:26

struct passwd *getpwuid(uid_t uid);

The password database structure, passwd, defined in pwd.h,includes the following members:

Member               Description
char *pw_name          The user’s login name
uid_t pw_uid         The UID number
gid_t pw_gid         The GID number
char *pw_dir         The user’s home directory
char *pw_gecos         The user’s full name
char *pw_shell         The user’s default shell

fengyuganyu 发表于 2010-10-16 11:45:21

谢谢 LS的 问题解决了
页: [1]
查看完整版本: 求助:linux C 中怎么获得文件所有者的名 是名 ,不是uid