From: ern0 <ern0@linkbroker.hu>
To: linux-c-programming@vger.kernel.org
Subject: Re: line buffered stdin
Date: Mon, 11 Jan 2010 20:09:57 +0100 [thread overview]
Message-ID: <4B4B7785.8090708@linkbroker.hu> (raw)
In-Reply-To: <ea11fea31001110836q5afe9dcn1022bd7d80228abe@mail.gmail.com>
> Is there a function that reads stdin without line buffering?
You should set some terminal attr:
termios oldt;
[...]
tcgetattr(STDIN_FILENO,&oldt);
termios newt = oldt;
newt.c_lflag &= (~ICANON & ~ECHO);
tcsetattr(STDIN_FILENO,TCSANOW,&newt);
and restore the old state when you're done:
tcsetattr(STDIN_FILENO,TCSANOW,&oldt);
If you interrupt your program, you will see no echo, which is annoying.
Type - blind mode - at the shell prompt: "reset" (don't worry, it only
resets the terminal).
Gnome-terminal also clears the scrollback buffer upon "reset".
--
ern0.scene.plus4.amiga.code.muzak
Haben Sie Fragen?
next prev parent reply other threads:[~2010-01-11 19:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 16:27 line buffered stdin Bastian Ruppert
2010-01-11 16:36 ` Manish Katiyar
2010-01-11 19:09 ` ern0 [this message]
2010-01-11 20:51 ` Glynn Clements
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=4B4B7785.8090708@linkbroker.hu \
--to=ern0@linkbroker.hu \
--cc=linux-c-programming@vger.kernel.org \
/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 NNTP newsgroup(s).