摘要:
###参考伪代码实现ls的功能,提交代码的编译,运行结果截图,码云代码链接。 打开目录文件 针对目录文件 读取目录条目 显示文件名 关闭文件目录文件 相关代码 #include <stdio.h> #include <dirent.h> #include <sys/types.h> void myl 阅读全文
摘要:
###用系统调用实现who命令——mywho who功能 man who utmp man utmp 查看具体功能: 可以发现utmp可以显示登陆者的pid、登陆设备、登陆者的名字、登录主机的名字、退出状态等等,其中,登录时间被保存在tu_tv中。 man -k utmp 相关代码 #include 阅读全文
摘要:
相关代码 #include <stdio.h> #include <sys/types.h> #include <dirent.h> #include <sys/stat.h> #include <pwd.h> #include <grp.h> #include <unistd.h> #includ 阅读全文