Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29284 Discussions

Macro for getting source code line number

giovanni_81
Beginner
966 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
966 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