如何在fortran中的相同位置打印 [英] How to print in the same position in fortran

查看:63
本文介绍了如何在fortran中的相同位置打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过更改打印命令的格式或至少清除终端中的行来用其他字符替换终端中的字符?

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?

推荐答案

在标准Fortran中是不可能的.也许尝试使用 GNU Readline库.相关:从Fortran中的目录自动完成

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

如果您不使用Windows终端,则可以使用 ANSI转义码.例如,首先打印星星,然后移回同一行并在星星上写"test":

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

在Linux终端上测试过,在基本的Windows终端上将无法使用.

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

这篇关于如何在fortran中的相同位置打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆