bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about how to use newterm() to separate output streams


From: Christer Enfors
Subject: Question about how to use newterm() to separate output streams
Date: Wed, 14 Mar 2007 14:51:57 +0100
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)

I'm working on a program (in C, on AIX) called "instring". What I'm trying to make it do is display a one-line form (I'm using filter()) containing a single input field. After the user enters data in the input field, my program should print that string, and quit. The reason why it should print that string is because we have piles and piles of legacy scripts that captures that output from the old version of instring (which I didn't write, and which I'm now writing a replacement for). The scripts use this syntax to capture the output from instring:

  $ output=`instring`

This is supposed to ONLY capture my final printing of the input field, after the user is done typing it - but in my version of instring, it also captures the input field itself (a row of A_UNDERLINE characters), etc.

If I understood him correctly, Thomas Dickey kindly adviced me to use newterm() to get around this problem, but I'm not sure how I should go about it. Am I supposed to use newterm() to create a new SCREEN on which I should display my form? And then print the input received on stdout, so that the input is the only thing printed on stdout, and thus the only thing captured by the calling script?

But if the new SCREEN created by newterm() isn't connected to stdout, then how do I make it even display? Should I use dup() (or something) to connect the screen directly to the tty?

Or am I totally off base here? I wouldn't be surprised, as this is all very confusing for my little Swedish brain.

--
Christer Enfors




reply via email to

[Prev in Thread] Current Thread [Next in Thread]