#include <pwd.h> #include <sys/types.h>
void setpwent(void);
#include <pwd.h>
#include <sys/types.h>
main()
{
struct passwd *user;
int i;
for(i = 0; i < 4; i++)
{
user = getpwent();
printf("%s :%d :%d :%s:%s:%s\n", user->pw_name, user->pw_uid, user->pw_gid,
user->pw_gecos, user->pw_dir, user->pw_shell);
}
setpwent();
user = getpwent();
printf("%s :%d :%d :%s:%s:%s\n", user->pw_name, user->pw_uid, user->pw_gid,
user->pw_gecos, user->pw_dir, user->pw_shell);
endpwent();
}
root:0:0:root:/root:/bin/bash bin:1:1:bin:/bin daemon:2:2:daemon:/sbin adm:3:4:adm:/var/adm root:0:0:root:/root:/bin/bash
#include <pwd.h> #include <sys/types.h>
strcut passwd * getpwent(void);
struct passwd
{
char * pw_name; //用户账号
char * pw_passwd; //用户密码
uid_t pw_uid; //用户识别码
gid_t pw_gid; //组识别码
char * pw_gecos; //用户全名
char * pw_dir; //家目录
char * pw_shell; //所使用的shell 路径
};
#include <pwd.h>
#include <sys/types.h>
main()
{
struct passwd *user;
while((user = getpwent()) != 0)
{
printf("%s:%d:%d:%s:%s:%s\n", user->pw_name, user->pw_uid, user->pw_gid,
user->pw_gecos, user->pw_dir, user->pw_shell);
}
endpwent();
}
root:0:0:root:/root:/bin/bash bin:1:1:bin:/bin: daemon:2:2:daemon:/sbin: adm:3:4:adm:/var/adm: lp:4:7:lp:/var/spool/lpd: sync:5:0:sync:/sbin:/bin/sync shutdown:6:0:shutdown:/sbin:/sbin/shutdown halt:7:0:halt:/sbin:/sbin/halt mail:8:12:mail:/var/spool/mail: news:9:13:news:var/spool/news uucp:10:14:uucp:/var/spool/uucp: operator:11:0:operator :/root: games:12:100:games:/usr/games: gopher:13:30:gopher:/usr/lib/gopher-data: ftp:14:50:FTP User:/home/ftp: nobody:99:99:Nobody:/: xfs:100:101:X Font Server: /etc/Xll/fs:/bin/false gdm:42:42:/home/gdm:/bin/bash kids:500:500: : /home/kids:/bin/bash
#include <pwd.h> #include <sys/types.h>
void endpwent(void);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有