2013年10月20日
摘要: 一、系统调用方式1.文件描述符内核利用文件描述符来访问文件,文件描述符是非负整数。打开现存文件或新建文件时,内核会返回一个文件描述符。2.int open(const char *pathname, int flags) int open(cosnt char *pathname, int flags, mode_t mode) 描述:Given a pathname for a file, open() returns a file descriptor, a small,nonnegative integer for use in subsequent system calls... 阅读全文
posted @ 2013-10-20 16:59 运动和行动 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 1.time_t time(time_t *t)功能: 成功:返回日历时间,单位为秒 失败:返回-12.struct tm *gmtime(const time_t *timep)功能:成功:将参数timep所指定的日历时间转换为世界标准时间(即格林威治时间)失败:返回NULLstruct tm{ int tm_sec; int tm_min; int tm_hour; int tm_mday /* day of the month */ int tm_mon; int tm_year; int tm_wday; /* day of the week */ ... 阅读全文
posted @ 2013-10-20 16:16 运动和行动 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 一、GDB的使用1.gdb的主要功能启动被调试程序、指定位置停住程序、程序被停住时,查看程序状态(如变量值)2.使用说明gcc -g test.c -o test -g使程序可被调试gdb test 启动gdbbreak main第一个休息点:在main函数处设置断点run 运行程序list(l) 查看程序代码break(b) 函数名 在某函数入口处添加断点break 行号 在指定行添加断点break 文件名:行号 在指定文件指定行添加断点info break 查看所有设置的断点delete 断点编号(info break显示出来的Num)删除指定断点pri... 阅读全文
posted @ 2013-10-20 15:06 运动和行动 阅读(338) 评论(0) 推荐(0) 编辑