[erlang-questions] How to get the line number of current executable code?

Anders Nygren anders.nygren@REDACTED
Fri Aug 15 20:22:54 CEST 2008


2008/8/15 devdoer bird <devdoer2@REDACTED>:
> HI:
>
> I want to implement a function like "get_current_lineno()/0" to get the
> current line number of the calling point?
> Eg.
> .....
> ....
> io:format("current line is ~w\n",[get_current_lineno()])
> .....
>
> the above code will print the line number of the calling point in the source
> file.
>
> How can I do this  in erlang?

There is a predefined macro ?LINE that does that
so
io:format("current line is ~w\n",[?LINE])

/Anders

> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list