|
I've been playing around with this too, and I've run into the same problems. It seems that the only way to get data to cin so that in_avail() will notify you is to do a cin! For example, if you call cin<<x, but at the prompt type something like "5 10 15", then in_avail() will return the number of chars that are still in the buffer. In this case, either 6 or 7 (I can't remember which), because the first one has been eaten by your cin statement. As far as I can tell, this would be useful in figuring out how much data a user input, but only after the user actually input the data.
Or I could be completely wrong... Anyway, the code I posted above seems to work (based on your earlier suggestion). If anyone can get this working with cin, I'd be interested to hear how.
|