From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-05 08:27:55
I ran into exactly this problem in my previous job. A colleague blamed me
and the "stupid C++ committee" for not having standardized the ability to
look for an incoming keypress! If you have a portable implementation, please
do submit it.
----- Original Message -----
> For me, it's not a timing issue. It's a functionality issue. In my
> particular case, I am developing a chess engine (a chess playing
> program), in C++. For the sake of portability, it is kept as much as
> possible an adherence to the ANSI standard. My problem is, that I
> have to way to listen for input from stdin non-blockingly, while
> performing the search in the gamespace. So I have to use platform
> specific stuff. And even worse is the fact that on the Windows
> platform, this cannot be done device-independantly, but has to be
> done seperately for keyboard input and piped input.
> In my case, I don't really need that much functionality, I just want
> to know if an entire line (ending with a \n) is in the buffer or not.
> If it isn't, I ignore the input. But as soon as there is an entire
> line in the buffer, I read it and act on it. I poll a number of times
> a second during search in my case.
> Even if I would be extremely happy to have such a feature in C++
> (seeing that this feature is natively available on all the platforms
> that I would ever want my program to work on), this is not just a
> case of "I want this in my program, why hasn't it been done for me?
> Please add it to the standard". I really think that this feature is
> very general (a stream with non-blocking input capabilities), and
> naturally models a huge amount of logical and physical devices on
> real computers. Just as files, printing output, adding integer values
> etc. is very common.
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk