Re: ncurses getch SIGWINCH

From: DINH Viet Hoa (dinh.viet.hoa_at_free.fr)
Date: 01/27/05


Date: Thu, 27 Jan 2005 10:12:07 +0100

Average Joe wrote :

> My program sits in a blocking ncurses getch() call. When I receive the
> signal SIGWINCH (screen resize), how do I inject a character into the
> stdin so that getch will wake up?
>
> I know I can use a non-blocking getch() call but it rails the CPU, and
> sleeping is inefficient.

use select() with a timeout of 0.1 sec (sufficient most of time for
user interface) before getch()

-- 
DINH V. Hoa,
"Paraît-il que c'est ce que recherchent la majorité des djeunz. Il n'y a plus
aucun attrait pour les métiers scientifiques ni techniques. Ils veulent être
chanteur, acteur ou fonctionnaire. C'est désépérant..." -- Emmanuel Delahaye


Relevant Pages

  • Re: getch() allocconsole freeconsole
    ... I am using the "official" solution to fix the printf() code, however getch() ... does not use stdin or stdout, instead it uses the _coninpfh variable as ...
    (microsoft.public.win32.programmer.kernel)
  • Re: fflush(stdin)
    ... away all input characters waiting for getch() out of stdin. ... however compelling herd instinct may be. ...
    (comp.unix.programmer)
  • com1 getch() problem
    ... I use 'getch' to read the input from stdin, it seems not to work via serial port using null-modem cable, is 'getch' not compatibal with the ... serial portor some special settings needs to be set? ...
    (comp.unix.programmer)
  • ncurses getch SIGWINCH
    ... My program sits in a blocking ncurses getch() call. ... how do I inject a character into the ... stdin so that getch will wake up? ...
    (comp.unix.programmer)
  • getch() problem in linux
    ... I use 'getch' to read the input from stdin, it seems not to work via serial port,using null-modem cable, is 'getch' not compatibal with the ... serial port(com1) or some special settings needs to be set? ...
    (comp.os.linux)