How do I format a PRINT or WRITE statement to overwrite the current line on the console screen?

后端 未结 4 740
借酒劲吻你
借酒劲吻你 2021-01-05 05:04

I want to display the progress of a calculation done with a DO-loop, on the console screen. I can print out the progress variable to the terminal like this:

         


        
4条回答
  •  时光取名叫无心
    2021-01-05 05:38

    The following worked perfectly using g95 fortran:

          NF = NF + 1
          IF(MOD(NF,5).EQ.0) WRITE(6,42,ADVANCE='NO') NF, ' PDFs'//CHAR(13)
      42  FORMAT(I6,A)
    

    gave: 5 PDFs

    leaving the cursor at the #1 position on the same line. On the next update, the 5 turned into a 10. ASCII 13 (decimal) is a carriage return.

提交回复
热议问题