0

Hi friends,
Please suggest me how to display the line number in C program. without using predefined macros, or windows library files.

4
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by nmaillet
0

In Pelles C it's under the Source pull down menu, then select "view line numbers".

Check around your IDE editor options, also. Not every IDE editor has this, for an option.

0

sorry.....i don't want to see line numbers in editior........i want the line number to be displayed on output..........like we get in assert funtion...

0

without using predefined macros

What is with you people asking a question and then immediately rejecting the best solution? What do you think the __LINE__ macro was designed for?

0

When you compile the source code, everything gets translated to machine code, and everything ends up being referenced by a memory address. In addition, the compiler will likely optimize your code, and will not maintain any 1 to 1 relation to the source code. The idea of a line number is lost by this point. It may be possible to use a debug file (such as a PDB file from VisualC++) to achieve this, but that would not be a trivial task.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.