Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29273 Discussions

Macro for getting source code line number

giovanni_81
Beginner
945 Views
I was wondering if exists (in Visual Fortran 10.1.029) some kind of macro/directive that allows to get the current source code line number.
In fact, in a WRITE statement I would like to put as part of the output string the current line code.
Does anything similar also exist to get the current source code file name?

Thank you,

regards.
0 Kudos
1 Reply
thomas_boehme
New Contributor II
945 Views
Quoting - giovanni_81
I was wondering if exists (in Visual Fortran 10.1.029) some kind of macro/directive that allows to get the current source code line number.
In fact, in a WRITE statement I would like to put as part of the output string the current line code.
Does anything similar also exist to get the current source code file name?

Thank you,

regards.

You can use the C-preprocessor for that.

You need to set Fortran->Preprocessor->Preprocess Source File to YES, then you can use __LINE__ to get the line number in the code.

Best regards,
Thomas
0 Kudos
Reply