Re: [Anjuta-list] executing a program in 1.8



On Mon, 2002-01-07 at 22:54, Stephane Demurget wrote:
> On Mon, 2002-01-07 at 13:06, Naba Kumar wrote:
> > On Mon, 2002-01-07 at 03:23, Andy Piper wrote:
> > > On 2002.01.06 21:23 Greg Sarsons wrote:
> > > > I tried executing a program in a terminal and after the program
> > > > was done the bottom of the message was "Press any key to
> > > > close this terminal ..." was displayed.
> > My idea was to really accept "any key", but it seems the getchar() call
> > in anjuta_launcher.c isn't working properly.
> > 
> > Limiting it to "Enter", obviously, will not be a problem, because the
> > "Enter" key will be always there on the keyboard along with the rest of
> > the keys. :)
> On UNIX systems, the default terminal mode requires that a user
> press the Enter key to submit a line of text. This mode allows the use
> of line-editing characters, like backspace, before the input goes to the
> program. The terminal is known as in "cooked" mode. So we need to use
> the "raw" mode, which enables one char-at-a-time mode.
> 
> Either we use the harder way (system calls) or the easy way is to use
> stty like this (this works on any Unix system) :
> 
> 	system("stty raw");
> 
> 	c = getchar();
> 	printf("%c (%d)\n", c, c);
> 
> 	system("stty cooked");
> 
> Do you like this way or system calls (but I don't know about the
> portability issue) ? Tell me before I do it.

I think we should go for the simpler way that Andy has suggested. That
is changing the statement to "Press Enter ...". I don't think anyone
will complain about the trouble in pressing "Enter", unless of course
he/she is too lazy. :-)

-- 
Regards,
-naba

Some marriages are made in heaven -- but so are thunder and lightning.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





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