Possible Duplicate:
C/C++ line number
I want to display the line number where the printf is triggered?
It may look like this:
printf("the line number is: %d",SOME_LIBC_MACRO);
How to do it?
Possible Duplicate:
C/C++ line number
I want to display the line number where the printf is triggered?
It may look like this:
printf("the line number is: %d",SOME_LIBC_MACRO);
How to do it?
Use the __LINE__
macro
printf("the line number is: %d", __LINE__);
Lists of other pre-defined macros are available for GCC and Visual Studio