I am trying Fortran to output to screen without making paragraphs - i.e. output several times but in a row. The code below outputs correctly to screen if I compile the program and run it from the command line. However, it does not output to screen if I am using the debug feature of Visual Studio. Is there any work around or a better solution to this?
program test implicit none integer :: ind do ind = 1,20 write(*,'(1x,i0)',advance='no') ind !Some other stuff here end do end program
That's very interesting, and I can reproduce the behavior. While if one runs the program not under the debugger, you see the output, if you step through the program with the debugger output never appears, even at the end of the program.
I did find a workaround. Change the WRITE(*) to WRITE(6) and add, after the WRITE:
If you change the project property Fortran > Language > Enable F2003 Semantics to Yes, you don't have to change the WRITE, though to be formally correct you should change the program to:
program test use, intrinsic :: ISO_FORTRAN_ENV implicit none integer :: ind do ind = 1,20 write(*,'(1x,i0)',advance='no') ind flush(OUTPUT_UNIT) !Some other stuff here end do end program
I recommend that you report this problem to Intel using https://supporttickets.intel.com/