Is there any possibilty to get the terminal line width in Fortran (90) beside calling tput cols, which, if possible, is cross platform?
I am only using gfortran, so it is sufficient if it works with this compiler.
Is there any possibilty to get the terminal line width in Fortran (90) beside calling tput cols, which, if possible, is cross platform?
I am only using gfortran, so it is sufficient if it works with this compiler.
Terminal/console functionality is always a system depends feature. It means, that getting a terminal width will be different for Unix and Windows systems. One of the library that can help you is ncurses, writen in C language. There are some Fortran interfaces for this library, like this uses Fortran 2003.
If this library will fit your requirements, please look at integer variables LINES and COLS defined in , they will be filled with the size of the screen.
In Fortran interface, mentioned before, there are getmaxyx subroutine:
subroutine getmaxyx(win,y,x) bind(C, name='macro_getmaxyx')
use iso_c_binding
use ncurses_types
type (C_PTR), value :: win
integer(C_INT) :: y,x
end subroutine
it stores the size of the specified window.