Redirecting stdin (was Re: retokenize tables)

Kenneth Brody kenbrody at bestweb.net
Wed Jan 24 10:28:06 PST 2007


Quoting Jay R. Ashworth (Wed, 24 Jan 2007 13:17:39 -0500):

> On Wed, Jan 24, 2007 at 12:28:57PM -0500, Kenneth Brody wrote:
[...]
> > Windows, on the other hand, simply doesn't work that way.  The console
> > API functions just don't work as expected if you are not really using
> > the console as I/O.
>
> Nope, it don't.  :-)
>
[...]
> > hang due to the console API calls failing.  (Specifically, the
> > PeekConsoleInput API call fails with an "invalid handle" error, as
> > the handle is not a console handle.  I'm pretty sure that the
> > ReadConsoleInput API call would fail the same way for the same
> > reason.)
>
> Yay, Microsoft!

There's even a note on the ReadConsole() man page:

    http://msdn2.microsoft.com/en-us/library/ms684958.aspx

        ReadConsole fails if used with a standard handle that has been
        redirected to be something other than a console handle.

The low-level PeekConsoleInput() and ReadConsoleInput() fail as well,
though there is no such note on their pages.

--
KenBrody at BestWeb dot net        spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com


More information about the Filepro-list mailing list