This topic is now archived and is closed to further replies.

Checking for input waiting at stdin (not kbhit())

This topic is 5011 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey there, I''ve been searching for a way to check if input is waiting at stdin without using kbhit(), but I''m fairing poorly. Any ideas? It seems kbhit() only checks if a key was pressed A little background.. App A creates some pipes (CreatePipe) and creates an instance of App B, with redirected stdin/stdout (App A can send data to it''s stdin, read data from it''s stdout)... This works fine. However, App B is supposed to respond to what''s sent to it in a nice manner. Effectively, App A sends it commands.. App B is supposed to check regularly if there is any input to process. However, kbhit() doesnt work on stdin, it seems it only works with the keyboard... And getch() or ReadFile on stdin (which I retrieve in App B using GetStdHandle(STD_HANDLE_STDIN)) would cause a block. Another strangeness to note, PeekNamedPipe() doesnt work on the returned handle from GetStdHandle(STD_HANDLE_STDIN).. It says ''invalid handle'', though GetStdHandle() doesn''t return INVALID_HANDLE_VALUE, it returns "3". *shrug* Can anyone help me out here? Any ideas? Thanks... K

Share this post

Link to post
Share on other sites