public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Claudio Bley" <bley@cs.uni-magdeburg.de>
To: Ish Rattan <ishwar@pali.cps.cmich.edu>
Cc: <gcc-help@gcc.gnu.org>
Subject: Re: Unbuffered line input and the GNU library
Date: Tue, 20 Aug 2002 11:20:00 -0000	[thread overview]
Message-ID: <15714.34848.442304.695492@wh2-19.st.uni-magdeburg.de> (raw)
In-Reply-To: <Pine.LNX.4.33L2.0208192331040.2960-100000@pali.cps.cmich.edu>

>>>>> "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 / \

      reply	other threads:[~2002-08-20 18:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-19 19:24 Steve Dondley
2002-08-19 20:36 ` Ish Rattan
2002-08-20 11:20   ` Claudio Bley [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15714.34848.442304.695492@wh2-19.st.uni-magdeburg.de \
    --to=bley@cs.uni-magdeburg.de \
    --cc=gcc-help@gcc.gnu.org \
    --cc=ishwar@pali.cps.cmich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).