Skip to contentSkip to conversation

Size of the terminal with curses

DISCUSSION Tyler 5 participants 5 messages Oct 20, 2004 – Oct 21, 2004

lore
Share & tools
lore

Tyler

author
#0 lore raw

Hey,

How can I get the size of the terminal (in lines and cols) of the actual terminal ? It would be cool if the solution uses some curses function.

Thx

#1 lore raw

On Wed, 2004-10-20 22:11:23 +0200, Tyler <[email protected]> wrote in message <[email protected]>:

Quoted 2 lines

How can I get the size of the terminal (in lines and cols) of the actual terminal ? It would be cool if the solution uses some curses function.

It's LINES and COLS, see <curses.h>.

MfG, JBG

Signature · 4 lines
Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
#3 lore raw
In reply to Tyler
Quoted 3 lines · Tyler

How can I get the size of the terminal (in lines and cols) of the actual terminal ? It would be cool if the solution uses some curses function.

Get the values of the 'LINES' and 'COLUMNS' env variables using getenv().

#2 lore raw
In reply to Jan-Benedict Glaw

Hi,

Calling ioctl with TIOCGWINSZ, would be another soulution... (tty_ioctl(4)). However I am no expert, please correct me if the above doesn't work with curses.

Andrei

Quoted 7 lines · Jan-Benedict Glaw

On Wed, 2004-10-20 22:11:23 +0200, Tyler <[email protected]> wrote in message <[email protected]>:

Quoted 2 lines

How can I get the size of the terminal (in lines and cols) of the actual terminal ? It would be cool if the solution uses some curses function.

It's LINES and COLS, see <curses.h>.

Quoted 10 lines

MfG, JBG

--

Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O

fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to Tyler

hello

Quoted 3 lines · Tyler

Hey,

How can I get the size of the terminal (in lines and cols) of the actual terminal ? It would be cool if the solution uses some curses function.

nothing to do with ncurses... juste use LINES and COLS macro...

simon