Vertical tab in a Windows OS window
Vertical tab in a Windows OS window
(OP)
I'm running my program from a windowsOS command line window and outputting data and character strings to the same window.
I can write non-advancing output and overwrite the same line via backspaces and writing again (on the same line).
Is it possible, with Fortran, to do an upward vertical tab and overwrite the line above, in a windowsOS command line window?
Thank you.
I can write non-advancing output and overwrite the same line via backspaces and writing again (on the same line).
Is it possible, with Fortran, to do an upward vertical tab and overwrite the line above, in a windowsOS command line window?
Thank you.





RE: Vertical tab in a Windows OS window
RE: Vertical tab in a Windows OS window
Thank you.
Regarding Alternatively there are some windows routines to move the cursor to any point on the screen.
To get me started, what are the names of these windows routines?
Are they in the form of a dll requiring a multilanguage call from Fortran to C++ via interface statements?
RE: Vertical tab in a Windows OS window
They are normally multilanguage but dev systems like Intel already have the interfaces: all you need to do is call them. I may even be able to give you an example but I have to know what development system you're using.
RE: Vertical tab in a Windows OS window
RE: Vertical tab in a Windows OS window
CODE
CODE --> cursorg.f90
module winconsole use, intrinsic:: ISO_C_BINDING type, bind(C):: COORD integer(C_SHORT) X integer(C_SHORT) Y end type COORD integer (C_LONG), parameter:: STD_INPUT_HANDLE = -10 integer (C_LONG), parameter:: STD_OUTPUT_HANDLE = -11 integer (C_LONG), parameter:: STD_ERROR_HANDLE = -12 interface function GetStdHandle(nStdHandle) & bind (C, name='GetStdHandle') import !GCC$ attributes dllexport, stdcall :: GetStdHandle integer (C_INTPTR_T) GetStdHandle integer (C_LONG), value:: nStdHandle end function GetStdHandle function SetConsoleCursorPosition (hConsoleOutput, dwCursorPosition ) & bind (C, name='SetConsoleCursorPosition') import !GCC$ attributes dllexport, stdcall :: SetConsoleCursorPosition integer(C_INT) SetConsoleCursorPosition integer(C_INT), value:: hConsoleOutput type(COORD), value:: dwCursorPosition end function SetConsoleCursorPosition function WriteFile (hConsoleOutput ,lpCharacter ,nLength , lpNumberOfCharsWritten, overlapped ) & bind (C, name='WriteFile') import !GCC$ attributes dllexport, stdcall :: WriteFile integer (C_INT) WriteFile integer (C_INT), value:: hConsoleOutput character(kind=C_CHAR):: lpCharacter(1) integer (C_INT), value:: nLength integer (C_INT) lpNumberOfCharsWritten integer (C_INT) overlapped end function WriteFile function GetLastError() bind(C, name='GetLastError') import !GCC$ attributes dllexport, stdcall:: GetLastError integer (C_INT) GetLastError end function GetLastError end interface contains end module winconsole program cursorg use, intrinsic :: ISO_C_BINDING use winconsole integer(C_LONG):: ires, written, leng integer(C_INTPTR_T):: hout type(COORD) posn integer, parameter:: TITLE_LEN = 80 character(len=TITLE_LEN):: str hout = GetStdHandle(STD_OUTPUT_HANDLE) if (hout .eq. -1) then ires = GetLastError() print *, ires stop end if posn%x = 40 posn%y = 10 str = 'Hey it works' ires = SetConsoleCursorPosition(hout, posn) leng = len_trim(str) ires = WriteFile(hout, str, leng, written, 0) read (*,*) str end programRE: Vertical tab in a Windows OS window