当前位置:网站首页>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__ ) );
边栏推荐
- 高通&MTK&麒麟 手機平臺USB3.0方案對比
- ESP8266通过Arduino IDE连接Onenet云平台(MQTT)
- 树莓派 轻触开关 按键使用
- Gallery之图片浏览、组件学习
- XML file explanation: what is XML, XML configuration file, XML data file, XML file parsing tutorial
- I2C总线时序详解
- Apprentissage automatique - - régression linéaire (sklearn)
- MySQL START SLAVE Syntax
- 【yarn】Yarn container 日志清理
- C语言,log打印文件名、函数名、行号、日期时间
猜你喜欢

Basic knowledge of lithium battery

荣耀Magic 3Pro 充电架构分析

OPPO VOOC快充电路和协议

Correspondence between STM32 model and contex M

Password free login of distributed nodes

4. Install and deploy spark (spark on Yan mode)

PyTorch四种常用优化器测试

error C4996: ‘strcpy‘: This function or variable may be unsafe. Consider using strcpy_ s instead

分布式节点免密登录

MongoDB
随机推荐
Come and walk into the JVM
RT-Thread 线程的时间片轮询调度
L2-001 emergency rescue (25 points)
arduino JSON数据信息解析
There are three iPhone se 2022 models in the Eurasian Economic Commission database
[Flink] Flink learning
Machine learning -- linear regression (sklearn)
Vert. x: A simple TCP client and server demo
Comparison of solutions of Qualcomm & MTK & Kirin mobile platform USB3.0
共用体(union)详解【C语言】
[CDH] cdh5.16 configuring the setting of yarn task centralized allocation does not take effect
常用正则表达式整理
MongoDB
[NPUCTF2020]ReadlezPHP
Kaggle竞赛-Two Sigma Connect: Rental Listing Inquiries(XGBoost)
Détails du Protocole Internet
JS array + array method reconstruction
4. Install and deploy spark (spark on Yan mode)
荣耀Magic 3Pro 充电架构分析
Common regular expression collation