Input Redirection for Windows Command Line Apps


Hi all;

I am renovating an old DOS app to run under Windows.

At one point, input redirection is being facilitated with
DOS interrupt 0x21. Service 0x0b is used to check to see
if there is anything in the queue, and service 0x08 is
used to get anything from the queue should there be
anything found.

What would be the equivalent functions for performing
the same operations, either in .NET, or the Microsoft RTL?

Thanks!!!

UPDATE:

I can use getc(stdin) to load the contents of a file used for redirected input.

The only problem now is how do I test that there is anything in the stdio stream
(in the case where there is no redirected input)? Without such a test, it hangs
until I use CTRL+BREAK.

Thanks!!!

UPDATE: problem solved.
I was going to post the following (but had to go pick up my wife and kids):
Use the WaitForSingleObject() function.
http://www.google.com/search?btnI=1&q=msdn+WaitForSingleObject

An example:
http://www.cplusplus.com/forum/beginner/1988/page3.html#msg14102
(You'll have to set your timeout to zero.)

Hope this helps.

How did you solve it?
Topic archived. No new replies allowed.