C语言我自己的宏定义
Posted Dontla
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C语言我自己的宏定义相关的知识,希望对你有一定的参考价值。
20220420 在打印格式化内容前加上当前时间
(定义)
//arnold 20220420 ky_printf_format_time() start
void ky_printf_format_time()
char format_time[64] = 0;
int ret = ky_get_format_time(format_time, sizeof(format_time));
if(ret == 0)
printf("ky_printf_string_and_format_time get format time failed!\\n");
printf("[%s]", format_time);
//arnold 20220420 ky_printf_format_time() end
#define KY_PRINTF_STRING_AND_FORMAT_TIME ky_printf_format_time();printf
(调用)
KY_PRINTF_STRING_AND_FORMAT_TIME("The program is going to be ended!\\n");
int sig = 15;
KY_PRINTF_STRING_AND_FORMAT_TIME("demo_signal_call_back has received signal [%d]\\n", sig);
(结果)
[2022-04-20_14-08-50]The program is going to be ended!
[2022-04-20_14-08-50]demo_signal_call_back has received signal [15]
以上是关于C语言我自己的宏定义的主要内容,如果未能解决你的问题,请参考以下文章