当前位置:网站首页>C language, log print file name, function name, line number, date and time
C language, log print file name, function name, line number, date and time
2022-07-06 11:58:00 【Weiyuan escort agency】
• __LINE__: Insert the current source line number in the source code
• __FILE__: Insert the current source file name... In the source file
• __FUNCTION__: Function name
• __DATE__: Insert the current compile date... In the source file
• __TIME__: Insert the current compile time... In the source file
C Language use printf(“filename:%s”, FILE); Print file name , If it is found, the directory where the file is located will also be printed out
#include <string.h> //strrchr() The header file required by the function
//windows:
#define filename(x) strrchr(x,'\\')?strrchr(x,'\\')+1:x
//linux :
#define filename(x) strrchr(x,'/')?strrchr(x,'/')+1:x
printf( "filename:%s\n", filename( __FILE__ ) );
边栏推荐
- Contiki source code + principle + function + programming + transplantation + drive + network (turn)
- Small L's test paper
- nodejs连接Mysql
- Detailed explanation of nodejs
- MySQL START SLAVE Syntax
- 2020 WANGDING cup_ Rosefinch formation_ Web_ nmap
- I2C bus timing explanation
- Word排版(小计)
- Using LinkedHashMap to realize the caching of an LRU algorithm
- [mrctf2020] dolls
猜你喜欢
随机推荐
关键字 inline (内联函数)用法解析【C语言】
Password free login of distributed nodes
分布式节点免密登录
C语言函数之可变参数原理:va_start、va_arg及va_end
Mall project -- day09 -- order module
Detailed explanation of 5g working principle (explanation & illustration)
arduino获取数组的长度
Matlab learning and actual combat notes
【CDH】CDH5.16 配置 yarn 任务集中分配设置不生效问题
Word排版(小計)
Machine learning -- linear regression (sklearn)
RT-Thread的main线程“卡死”的一种可能原因及解决方案
Basic knowledge of lithium battery
ESP8266通过Arduino IDE连接Onenet云平台(MQTT)
电商数据分析--用户行为分析
2019 Tencent summer intern formal written examination
[Bluebridge cup 2020 preliminary] horizontal segmentation
There are three iPhone se 2022 models in the Eurasian Economic Commission database
Mysql database interview questions
使用LinkedHashMap实现一个LRU算法的缓存