//new testdatamaker
Right, you need to flush. You don't need the intermediary strstream
though. You also were missing a "using namespace std;" at the top,
that suggests to me that you are using a very old compiler.
I need to flush, yes. now we are talking...
my compiler is ancient.
No, if you read my previous post it may legitimately return 0 under
those circumstances.
Thank's tom now I understand.
( sorry it didn't make it all through the first time you explained )
Possibly - the function "showmanyc" can be overrided by the
implementer to try to work out how many characters are waiting. If the
streambuf doesn't have any characters buffered, it will return
"showmanyc" when you call "in_avail".
What are your requirements? What is wrong with your original blocking
program? As I said before, you have to make stdin a non-blocking
stream. e.g.
int result = fcntl(STDIN, F_SETFL, O_NONBLOCK);
or even better, use "select" on STDIN.
now we are talking, that is something useful for me.
My intention is to create an application for showing of debug stream
data from application(s) in development, or application(s) in the run
outputting debug live data. So my application may (or may not, depending
on if the user is interested in seeing the debug data ) wait on
cin/stdin until the data is there to be read. Further, the applciation
must be able to cancel waiting, therefore it needs non-blocking access
to stdin/cin, because there may be data, or not data, and teh user may
have chosen to read, or not to read. Those are gui options. That's why I
can't attempt to read when no data is there because the read will block
indefinitly, or until there is data to be read.
Thank's tom, and wish you a nice day
Thank you all the others, too.
/B