public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Unbuffered line input and the GNU library
@ 2002-08-19 19:24 Steve Dondley
  2002-08-19 20:36 ` Ish Rattan
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Dondley @ 2002-08-19 19:24 UTC (permalink / raw)
  To: gcc-help

I'm new to C, learning from a beginner's book.  The book mentions in passing
that unbuffered line input can be accomplished with the non-standard getch()
function.  However, I did a grep on every *.h file on my computer and wasn't
able to locate the function's declaration.  A message in this list's archive
hinted that getch() might be in the 'ncurses', 'curses', or 'termcap' header
files.  However, these don't seem to exist in my library either.  I looked
on the web for some kind of documentation for getch() and that proved
fruitless as well.  So I have some basic questions:

1)  Where are all the GNU C library functions documented?

2)  Where can I download the GNU C library functions from and how do I
install them?  I tried 'apt-get install ncurses' but I got some funky
message about ncurses being obsoleted or not available.

3)  If I'm going in the wrong direction, my question is: How do you perform
unbuffered line input with the GNU C library.

I'm running Debian/Woody, GCC version 2.95.4 (Debian prerelease).

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Unbuffered line input and the GNU library
  2002-08-19 19:24 Unbuffered line input and the GNU library Steve Dondley
@ 2002-08-19 20:36 ` Ish Rattan
  2002-08-20 11:20   ` Claudio Bley
  0 siblings, 1 reply; 3+ messages in thread
From: Ish Rattan @ 2002-08-19 20:36 UTC (permalink / raw)
  To: gcc-help

On Mon, 19 Aug 2002, Steve Dondley wrote:

> function.  However, I did a grep on every *.h file on my computer and wasn't
It is a macro defined in /usr/include/stdio.h

-ishwar

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Unbuffered line input and the GNU library
  2002-08-19 20:36 ` Ish Rattan
@ 2002-08-20 11:20   ` Claudio Bley
  0 siblings, 0 replies; 3+ messages in thread
From: Claudio Bley @ 2002-08-20 11:20 UTC (permalink / raw)
  To: Ish Rattan; +Cc: gcc-help

>>>>> "Ish" == Ish Rattan <ishwar@pali.cps.cmich.edu> writes:

    Ish> On Mon, 19 Aug 2002, Steve Dondley wrote:
    >> function.  However, I did a grep on every *.h file on my
    >> computer and wasn't
    Ish> It is a macro defined in /usr/include/stdio.h

I can't find it there (glibc 2.2.5 Debian GNU/Linux). What's the
version of your C library that you're using?

Usually, in order to get unbuffered line input you need to switch the
terminal to unbufferd input mode (and properly restore it when done -
I guess this wouldn't work with a simple macro; I'd really like to see
the macro if it really is there).

Here's some code I used for this purpose:

,----
|   struct termios tio_orig;
|   struct termios tio_new;
| 
|   tcgetattr(0, &tio_orig);
| 
|   tio_new = tio_orig;
|   tio_new.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */
|   tcsetattr(0,TCSANOW,&tio_new);
|   
|   /* ... */
| 
|   tcsetattr(0,TCSANOW,&tio_orig);
`----

Cheers.

-- 
Claudio Bley                                                        _ 
                                             ASCII ribbon campaign ( )
ICQ# 83197241                                 - against HTML email  X 
http://www.cs.uni-magdeburg.de/~bley/                     & vCards / \

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-20 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-19 19:24 Unbuffered line input and the GNU library Steve Dondley
2002-08-19 20:36 ` Ish Rattan
2002-08-20 11:20   ` Claudio Bley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).