polling streams

N

Noah Roberts

Bob said:
Hi all
I need a way to poll the input standard stream if there is data to read
from it. Is there any way ( standard )to do this?

There is no standard way. You will need to find a newsgroup particular
to your operating system.
 
B

Bob Smith

Hi all
I need a way to poll the input standard stream if there is data to read
from it. Is there any way ( standard )to do this?
thank you for any help, much appreciated.
/B
 
N

Noah Roberts

Rolf said:
Noah Roberts wrote:




That's not right. There is a way: std::cin.rdbuf()->in_avail()

I stand corrected. Here I have been using select all this time...
 
B

Bob Smith

Noah said:
There is no standard way. You will need to find a newsgroup particular
to your operating system.

oh no, seems so basic.
Is there somekind of "workaround", I just need to poll and read a set of
event objects from the cin, but I want the gui to work while reading.
as for now the gui hangs, ( no surprise ) while the read object attempts
to read. could this be done in another way perhaps?
any ideas and help much appreciated

/B
 
T

tom_usenet

Hi all
I need a way to poll the input standard stream if there is data to read
from it. Is there any way ( standard )to do this?

Sort of. You can see if there is any more data buffered using:

is.rdbuf()->in_avail();

If that's not enough, you're going to need platform specific functions
like select or WaitFor*.

Tom
 

Ask a Question

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.

Ask a Question

Members online

Forum statistics

Threads
474,145
Messages
2,570,824
Members
47,371
Latest member
Brkaa

Latest Threads

Top