焦作网站建设焦作,公司邮箱从哪里登录,cms系统管理,常州网警在编程时#xff0c;有时需要知道当前的代码是在第几行#xff0c;当前文件名是什么#xff0c;以及当前执行的是哪个函数#xff1f;下面的代码可以轻松地完成这种功能#xff1a;
#include stdio.hvoid test(){printf(Line:%d, File:%s, Function:%s\n有时需要知道当前的代码是在第几行当前文件名是什么以及当前执行的是哪个函数下面的代码可以轻松地完成这种功能
#include stdio.h
void test()
{
printf(Line:%d, File:%s, Function:%s\n, __LINE__, __FILE__, __FUNCTION__);
}
int main()
{
printf(Line:%d, File:%s, Function:%s\n, __LINE__, __FILE__, __FUNCTION__);
test();
return 0;
}
运行结果
Line:10, File:t.c, Function:main
Line:5, File:t.c, Function:test