libite 2.6.1
conio.c File Reference
#include <poll.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>

Go to the source code of this file.

Functions

void initscr (int *row, int *col)
 

Detailed Description

Author
Joachim Wiberg
Date
2009-2021

Definition in file conio.c.

Function Documentation

◆ initscr()

void initscr ( int * row,
int * col )

Probe terminal size

Parameters
rowpointer to integer to store number of rows
colpointer to integer to store number of columns

This function checks if stdin and stdout isatty() and then sets the TTY in raw mode to silently ask the size using ANSI escape sequences. This is achieved by trying to go to corner 999,999 followed by querying the cursor position. Afterwards the TTY is returned to the state if was before, e.g. cooked. The number of rows and columns is returned in the input arguments to this function.

If stdio is not a TTY, then a default 24x80 is returned.

Definition at line 44 of file conio.c.