调试定位错误:__FILE__和__LINE__
2016-11-21 21:04
357 查看
no.1
#include < stdio.h >
int main( int , char ** )
{
printf( " This fake error is in %s on line %d\n " , __FILE__, __LINE__);
return 0 ;
}
no.2
#define error(x) my_error(__FILE__, __LINE__, x)
void my_error(const char* file, const int line, const char* msg)
{
printf("Error at %s:%d: %s\n", file, line, msg);
}
int main()
{
printf("hello\n");
error("a fetal error");
return 0;
}
#include < stdio.h >
int main( int , char ** )
{
printf( " This fake error is in %s on line %d\n " , __FILE__, __LINE__);
return 0 ;
}
no.2
#define error(x) my_error(__FILE__, __LINE__, x)
void my_error(const char* file, const int line, const char* msg)
{
printf("Error at %s:%d: %s\n", file, line, msg);
}
int main()
{
printf("hello\n");
error("a fetal error");
return 0;
}
相关文章推荐
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- (转)使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 调试错误 debug assertion failed; file:dlgdata.cpp; line 43 分析析
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- 使用__FILE__和__LINE__定位错误
- Tiny6410开发板linux启动错误 /init: line 102: can't open /r/dev/console: no such file 的解决方法
- __FILE__,__LINE__,FUNCTION__实现代码跟踪调试(linux下c语言编程 )(转)
- JS的错误快速定位--JavaScript调试技巧