问题
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