UNIX环境C语言编程(5)-系统数据文件
来源:互联网 发布:清梦繁华冢 知乎 编辑:程序博客网 时间:2024/06/05 09:07
1、密码文件/etc/passwd
•#include <pwd.h>
•struct passwd *getpwuid(uid_tuid); //根据uid读取
•struct passwd *getpwnam(const char *name);//根据名称读取
•struct passwd *getpwent(void); //顺序读取
•void setpwent(void); //回绕,从头再来
•void endpwent(void); //结束
2、组文件/etc/group
•#include <grp.h>
•struct group *getgrgid(gid_tgid); //根据gid读取
•struct group *getgrnam(const char *name); // 根据名称读取
•struct group *getpwent(void); //顺序读取
•void setgrent(void); //回绕,从头再来
•void endgrent(void); //结束
3、其它数据文件
4、系统标识
•#include <sys/utsname.h>
•int uname(structutsname *name); //获取系统信息
•struct utsname
•{
• char sysname[]; /* name of the operating system */
• char nodename[]; /* name of this node */
• char release[]; /* current release of operating system */
• char version[]; /* current version of this release */
• char machine[]; /* name of hardware type */
•};
•#include <unistd.h>
•int gethostname(char *name,intnamelen); //仅获取主机名称
5、时间/日期函数
•#include <time.h>
•#include <sys/time.h>
•time_t time(time_t *calptr);
•int gettimeofday(structtimeval *tp, void *tzp);
•struct tm *gmtime(consttime_t *calptr);
•struct tm *localtime(consttime_t *calptr);
•time_t mktime(struct tm *tmptr);
•char *asctime(conststruct tm *tmptr);
•char *ctime(consttime_t *calptr);
•size_t strftime(char *buf,size_tmaxsize,const char *format,conststruct tm *tmptr);
0 0
- UNIX环境C语言编程(5)-系统数据文件
- unix高级环境编程 系统数据文件与信息 --chap6
- linux系统数据文件和信息--unix环境高级编程读书笔记
- 《UNIX环境高级编程》--6系统数据文件和信息
- Unix环境高级编程-系统数据文件和信息
- 《UNIX环境高级编程》六系统数据文件和信息读书笔记
- 标准IO库、系统数据文件和信息 - UNIX环境高级编程-第5、6章
- UNIX环境C语言编程(1)-概述
- UNIX环境C语言编程(9)-信号
- UNIX环境C语言编程(14)-sockets
- UNIX环境C语言编程(17)-线程
- 读书笔记——《UNIX环境高级编程》第六章_系统数据文件和信息
- UNIX环境高级编程学习之第六章系统数据文件和信息-实现uid to name
- UNIX环境高级编程学习之第六章系统数据文件和信息-GID To GroupName
- unix高级环境编程 例子 代码实现练习 第六章:系统数据文件和信息
- 《UNIX环境高级编程》读书笔记之系统数据文件和信息(1)
- UNIX环境高级编程(第6章 系统数据文件和信息)
- 《unix高级环境编程》系统数据文件和信息——口令文件
- 一个开始
- Java 正则截取两个标签之间字符串
- cocos2dx android apk 在模拟器上运行失败
- Cocos2d-x中 发起http请求
- C语言:内存字节对齐详解[转载]
- UNIX环境C语言编程(5)-系统数据文件
- fatjar地址
- fatjar地址
- Windows核心编程笔记(6)----用户模式下的线程同步
- fatjar地址
- 2015年nefu寒假集训结构体排序专题解题报告
- knowledge_based topic model - AMC
- 踢开Eclisep&Aptana,Emacs变身强大IDE
- 输入一个字符串,统计共有多少个整数并输出。