we can use
__FUNCTION__ = a system macro ,that is the current function name
and
__LINE__ = a system macro ,that is the current line in the current function
to affiliate our debug . ^_^
for example :
printf("Error in func: %s,line :%d .n",__FUNCTION__,__LINE__);
and we can go further to do like this for efficiently debug :
#define DEBUG() printf("Error in func: %s,line :%d .n",__FUNCTION__,__LINE__)
then ,we can use it in our function :
infile=fopen(infilename,"rb");
if(NULL==infile)
DEBUG;
转载请注明:在路上 » debug tips