2013年10月20日
摘要: 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 运动和行动 阅读(194) 评论(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) 编辑
  2013年10月17日
摘要: 一、静态编译gcc -static a.c -o a.out gcc默认使用动态链接二、静态库的创建与使用 gcc -c mylib.c -o mylib.o 只编译不链接 ar cqs libmylib.a mylib.o 将*.o文件打包成库 cp libmylib.o /usr/lib/ gcc -static test.c -lmylib -o test gcc在链接时,默认只会链接C函数库,而对于其他的函数库 ,则需要使用-l选项来显示地指明需要链接三、动态库(共享库)的创建与使用 gcc -c mylib.c -o my... 阅读全文
posted @ 2013-10-17 08:36 运动和行动 阅读(253) 评论(0) 推荐(0) 编辑
  2013年10月15日
摘要: man:(very useful)规则: man 章节号 名称章节1:命令;章节2:系统调用函数; 章节3:库函数objdump 描述:objdump displays information about one or more object files. The options control what particular information to display.This information is mostly useful to programmers who are working on the compilation tools, as opposed to program 阅读全文
posted @ 2013-10-15 20:38 运动和行动 阅读(189) 评论(0) 推荐(0) 编辑