#include <stdlib.h>
#include <stdio.h>
#include <pwd.h>
int main(int argc, char* argv[])
{
struct passwd *ptPWD = getpwnam("daemon");
if(ptPWD != NULL)
{
printf("uid=%d,gid=%d\r\n", ptPWD->pw_uid, ptPWD->pw_gid);
}
else
printf("NULL\r\n");
return 0;
}
#include <stdio.h>
#include <pwd.h>
int main(int argc, char* argv[])
{
struct passwd *ptPWD = getpwnam("daemon");
if(ptPWD != NULL)
{
printf("uid=%d,gid=%d\r\n", ptPWD->pw_uid, ptPWD->pw_gid);
}
else
printf("NULL\r\n");
return 0;
}
本文介绍了一个简单的C语言程序,该程序使用标准库函数getpwnam()来查询名为'daemon'的用户信息,并打印出其UID和GID。
99

被折叠的 条评论
为什么被折叠?



