[LC++]using readline and istream input methods?

Jack Lloyd lloyd at randombit.net
Mon Nov 7 07:29:01 UTC 2005

It is usually easier to answer these things with code posted. But I *think*
what you want is to use the C++ function sync_with_stdio (Google it for
details). However, that will *only* work if readline is going through C stdio;
if for some reason it uses the file descriptor directly that that won't help.

Oh, and that also assumes readline isn't doing its own buffering...


On Sun, Nov 06, 2005 at 11:05:15AM +0100, Julien Claassen wrote:
> Hi!
>   I've got a problem, which may not be really on topic here, but I don't know
> where else to ask.
>   I've got a program where I use the readline library to read commands. Yet at
> some points I really think it's best to use getline or cin. Yet sometimes the
> following happens:
>    readline prompt> input <ENTER>
>   cin/getline: (some magic input I don't enter)
>   I tried to empty the input buffer, but I wasn't successful. Does anyone
> know:
>   1. how to empty the input buffer?
>   2. What this problem might be, if it isn't some backheld newline?
>   Kindest regards and thanks for any help!
>             Julien
> --------
> Music was my first love and it will be my last (John Miles)
> ======== FIND MY WEB-PROJECT AT: ========
> http://ltsb.sourceforge.net - the Linux TextBased Studio guide
> _______________________________________________
> This is the Linux C++ Programming List
> : http://lists.linux.org.au/listinfo/tuxcpprogramming List

More information about the tuxCPProgramming mailing list