当前位置:网站首页>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__ ) );
边栏推荐
- 选择法排序与冒泡法排序【C语言】
- arduino获取随机数
- Pytorch实现简单线性回归Demo
- 5G工作原理详解(解释&图解)
- IOT system framework learning
- Characteristics, task status and startup of UCOS III
- Comparison of solutions of Qualcomm & MTK & Kirin mobile platform USB3.0
- mysql实现读写分离
- {one week summary} take you into the ocean of JS knowledge
- 【presto】presto 参数配置优化
猜你喜欢
随机推荐
使用LinkedHashMap实现一个LRU算法的缓存
express框架详解
nodejs连接Mysql
常用正则表达式整理
TypeScript
优先级反转与死锁
wangeditor富文本组件-复制可用
Wangeditor rich text reference and table usage
互聯網協議詳解
高通&MTK&麒麟 手机平台USB3.0方案对比
Detailed explanation of express framework
共用体(union)详解【C语言】
几个关于指针的声明【C语言】
sklearn之feature_extraction.text.CountVectorizer / TfidVectorizer
[NPUCTF2020]ReadlezPHP
MySQL主从复制的原理以及实现
Togglebutton realizes the effect of switching lights
[MRCTF2020]套娃
Encodermappreduce notes
Principle and implementation of MySQL master-slave replication