![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++
C/C++相关
siam7tong
希望所有的发生都乐于接受。
展开
-
#define和typedef
宏定义 #define 预编译器进行处理,编译前执行替换操作。 format: #define 第一位置 第二位置 C中的一些预定义宏 __DATE__: 当前日期, 字符串常量,format = MMM DD YYYY __TIME__: 当前时间,字符串常量,format = HH:MM:SS __FILE__: 当前文件名,字符串常量 __LINE__: 当前行号,十进制常量 __STDC__: 编译器以ANSI标准编译时,为1 宏延续运算符 ( \) 字符串常量化运算符(#):为参数加.原创 2021-04-21 16:29:55 · 100 阅读 · 0 评论 -
C/C++ 获取系统时间
#include <ctime> #include <sys/time.h> struct timeval now_ac; struct tm now; 获取 毫秒 gettimeofday(&now_ac, nullptr); localtime_r(&now_ac.tv_sec, &now); int msec = now_ac.tv_usec / 1000; 获取 年月日时分秒 char date[30] = {0}; strftime(d.原创 2021-04-21 16:16:52 · 207 阅读 · 0 评论