有没有办法在控制台中隐藏光标运行时间在Fortran中?

问题描述 投票:2回答:1
  • 我编写了一个特定的软件,这个软件用于生成6个不同范围内随机数的文件。
  • 但是,我希望在运行时隐藏光标。

Is there any possible way to do this?

enter image description here


• Update •

::来自@Daniel R Livingston的回答

在第一篇文章中解决了未成年人适应的情况:::

“首先,打印转义码\e[?25l将隐藏你的光标。

\e[?25h将重新启用它。“

write (*,*)char(27)//char(91)//char(63)//char(50)//char(53)//char(108)

! for some reason, by using the 'result = systemqq' 
! may force the screen to "apply" the line above, only 
! after this, that escape gone works in Windows!

result = systemqq('@cls &@%windir%'//char(92)//'system32'//char(92)//'chcp.exe 850 2>nul >nul 1<&2&@color 0a')
write (*,*)char(27)//'[37;41;4m'//char(255)//char(250)//char(255)//'Generating',x,' Random Numbers!',char(27)
           &//'[0m'//char(10)//char(10)

!    Obs.: --------------------------------------------------------------------
!    Turn the cursor back by adding:
!    write (*,*),char(27)//'[?25h'  before end program (latest line) 
!     \e[?25l == char(27)//char(91)//char(63)//char(50)//char(53)//char(108)

enter image description here

fortran intel-fortran
1个回答
1
投票

两种方法可以做到这一点。

首先,打印转义码\e[?25l将隐藏光标。 \e[?25h将重新启用它。

其次,通过调用Windows API

BOOL WINAPI SetConsoleCursorInfo(
  _In_       HANDLE              hConsoleOutput,
  _In_ const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo
);
© www.soinside.com 2019 - 2024. All rights reserved.