Linux console dimensions
Posted: Wed Mar 13, 2024 5:42 am
				
				Maybe someone need it.
			Code: Select all
Structure winsize
  ws_row.w    ; rows
  ws_col.w    ; columns
EndStructure
#STDIN_FILENO = 0 ; file descriptor of standard input
#TIOCGWINSZ = $5413 ; IOCTL request to get terminal window sizes
OpenConsole()
ws.winsize
If ioctl_(#STDIN_FILENO, #TIOCGWINSZ, @ws) = 0
  PrintN("Text console sizes:")
  PrintN("Rows: " + Str(ws\ws_row))
  PrintN("Columns: " + Str(ws\ws_col))  
Else
  PrintN("Error getting console sizes.")
EndIf
Input()