D
DevarajA
How can i know if there are characters in the standard input using only
standard c++? I want to stop a loop when any key is pressed.
standard c++? I want to stop a loop when any key is pressed.
DevarajA said:How can i know if there are characters in the standard input using only
standard c++? I want to stop a loop when any key is pressed.
How can i know if there are characters in the standard input using only
standard c++? I want to stop a loop when any key is pressed.
As Artie said, you can't. Have a look at the FAQ:
http://www.parashift.com/c++-faq-lite/, in particular 15.17.
rossum
The ultimate truth is that there is no ultimate truth
DevarajA said:rossum ha scritto:
The faq talks about a keyboard.. and I know that c++ doesnt require a
keyboard, but somewhere there must be an input stream, so I just want
to know if there is even one character on it without stopping the
program (the function looks at the stream, if it's empty returns 0,
otherwise it returns 1). I think this could be possible.
No, it really, really, really isn't. There are frequently OS-specific libraries that will do what you want, though. Have
you actually looked at the FAQ 15.17?
DevarajA said:Lionel B ha scritto:
Yes but i can't get it working.
Anyway i'm already using a
non-standard function that works perfectly, I just wanted to make it
standard to avoid problems when porting.
What's the problem (I'm assuming you're on a Posix system)? If it's C++ related, why not post it here? Else in a Unix
programmers ng, maybe?
DevarajA said:Lionel B ha scritto:
the faq tells me to "poll", but i don't know how to poll
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.