C语言
文章平均质量分 51
张丨先生
这个作者很懒,什么都没留下…
展开
-
C语言之getopt函数
作用getopt()用来分析命令行参数。参数argc和argv分别代表参数个数和内容,跟main()函数的命令行参数是一样的。//头文件#include <unistd.h>//函数原型int getopt(int argc, char * const argv[], const char *optstring);参数说明argc:就是main函数的形参argc,表示参数的数量argv:就是main函数的形参argv,表示参数的字符串变量数组optstring:选项字符串原创 2022-05-21 22:47:42 · 418 阅读 · 0 评论 -
C语言之clock_gettime函数
作用clock_gettime是基于Linux C语言的时间函数,他可以用于计算精度和纳秒。//头文件#include <time.h>//函数原型int clock_gettime( clockid_t clock_id,struct timespec * tp );// timespec 结构体struct timespec { __time_t tv_sec; /* 秒 */ __syscall_s long_t tv_nsec; /* 纳秒 */};.原创 2022-05-20 23:08:51 · 5706 阅读 · 0 评论