How to print in the same position in fortran

雨燕双飞 提交于 2021-02-11 13:43:13

问题


Is it possible to replace a character in terminal with another character by changing format of print command or at least clear a line in terminal?


回答1:


It is not possible in standard Fortran. Perhaps try using the GNU Readline library. Related: Autocomplete from directory in Fortran

If you do not use the Windows terminal you can use the ANSI escape codes. For example, this first prints the stars, than moves back to the same line and writes "test" over the stars:

  print *, "***********"
  print *,achar(27)//"[2A"
  print *,"test"
end

Tested on a Linux terminal, will not work in the basic Windows terminal.



来源:https://stackoverflow.com/questions/26809555/how-to-print-in-the-same-position-in-fortran

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!