2

ncurses' blocking mode appears to only allow for blocking on stdin - that is, I have no option of doing some select()-esque thing where getch() blocks until either a key is pressed or e.g. data arrives in a pipe. Am I missing something, or is there some other terminal control library that allows me to do this?

Edit: I'm targeting Linux platforms, although the more general the solution, the better.

fouric
  • 1,598
  • 1
  • 19
  • 37
  • 1
    Apparently, the behavior of `getch()` is not portable, (See: https://stackoverflow.com/a/30433550/8507637). It would be helpful to include the operating system you are targeting. – oxr463 Jun 11 '19 at 02:58

1 Answers1

2

There's an experimental configure-option, which is rarely used:

--enable-wgetch-events
Compile with experimental wgetch-events code. See ncurses/README.IZ

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • 1
    this is interesting, although because i'm using a non-C language, making use of this feature would require both compiling and shipping a custom version of ncurses with my program and also creating my own FFI wrapper to expose `wgetch_events()` and `wgetstrn_event()` in addition to the "standard" functions. if necessary, i'll do this, but if there's something easier i would rather use that. – fouric Jun 04 '19 at 06:46
  • @fouric which language are you using? – oxr463 Jun 11 '19 at 02:52
  • @LucasRamage Common Lisp – fouric Aug 07 '19 at 23:35