Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get output from Ncurses app on a separate terminal

I would like a solution that allows me to detach a ncurses app to a different terminal emulator window and view the output of standard commands like 'cout' in the current one - for debugging and such.

I've seen a lot of solutions that write to a file and use tail but that seems quite hacky and slow. BTW. I have no idea where to even begin, I'm quite new with ncurses.

like image 685
niraami Avatar asked Dec 16 '25 23:12

niraami


1 Answers

You can initialize curses in one of two ways:

  • using initscr (which uses the standard input/output), or

  • using newterm (which lets you specify which input/output to use)

For example, the ncurses test-program ditto uses newterm to open output displays on one or more xterm's. Here is a screenshot:

ditto with 3 clients

In principle, you could use the current terminal for input, and display ncurses output on another terminal (though offhand, I don't recall any useful programs which do this — only demos).

like image 110
Thomas Dickey Avatar answered Dec 19 '25 14:12

Thomas Dickey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!