由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - owner of file
相关主题
where is user.listhow to change the log in shell?
bad root shell?问一个Unix Shell Script 的问题
[转载] 关于unix用户帐号UNIX文件系统一问
hotkey in unix[转载] Help, about clock().
Korn shell script[转载] UNIX下的strtok
questionCan I use user account to setup a ftp server?
能这样么?sed question??
[转载] 再来一份UNIX的题。奇怪的 C 问题
相关话题的讨论汇总
话题: group话题: user话题: name话题: file话题: unix
进入Unix版参与讨论
1 (共1页)
G****n
发帖数: 618
1
Can you tell me how to get the User name and Group
name of a file in the UNIX? I can only get the User ID
and Group ID by calling 'stat' or 'lstat'.
Thank yo
g****e
发帖数: 65
2
What Unix system you use?
In Solaris:
ls -l

【在 G****n 的大作中提到】
: Can you tell me how to get the User name and Group
: name of a file in the UNIX? I can only get the User ID
: and Group ID by calling 'stat' or 'lstat'.
: Thank yo

s*****d
发帖数: 258
3
I think he is talking about system calls.

【在 g****e 的大作中提到】
: What Unix system you use?
: In Solaris:
: ls -l

o**a
发帖数: 86
4

#include
#include
#include
...................
struct passwd * uptr = getpwuid(uid_t uid);
struct group * gptr = getgrgid(gid_t gid);
printf("%s", uptr->pw_name );
printf("%s", gptr->gr_name);

【在 G****n 的大作中提到】
: Can you tell me how to get the User name and Group
: name of a file in the UNIX? I can only get the User ID
: and Group ID by calling 'stat' or 'lstat'.
: Thank yo

G****n
发帖数: 618
5
Yes. Now I can use function getpwuid() to get the
owner of file, but how to get the group name?

【在 s*****d 的大作中提到】
: I think he is talking about system calls.
G****n
发帖数: 618
6
Thank you very much!

【在 o**a 的大作中提到】
:
: #include
: #include
: #include
: ...................
: struct passwd * uptr = getpwuid(uid_t uid);
: struct group * gptr = getgrgid(gid_t gid);
: printf("%s", uptr->pw_name );
: printf("%s", gptr->gr_name);

1 (共1页)
进入Unix版参与讨论
相关主题
奇怪的 C 问题Korn shell script
看看下面这个至少要多少行question
simple unix question能这样么?
请问在unix/linux能隐身吗?[转载] 再来一份UNIX的题。
where is user.listhow to change the log in shell?
bad root shell?问一个Unix Shell Script 的问题
[转载] 关于unix用户帐号UNIX文件系统一问
hotkey in unix[转载] Help, about clock().
相关话题的讨论汇总
话题: group话题: user话题: name话题: file话题: unix