Hi Chris and All!
Thanks a lot, I could'nt find this article!
Practically, I cannot accept this to be a solution: I always pass a
TextReader to a method and inside this method, I have to recognize, if the
stream is at the end or empty. The method cannot know, if this comes from
the Console.In TextReader. Wraping around the OS layer is one of the
requirements of the Framework.
I think, there were several bad decision while developing about the Console
class:Why should I assume, the TextReader to be already open? I checked the
Console.In to be null, but is'nt. Doing many things "automatically" presents
you problems on another end. In the FileStream class, ther is the Handle
property ....It looks like doing a Peek() opens the TextReader instead of
checking it.
Additionally, I have to run this proggi(s) also on some Unix machines and
using the W32 API would make it platform dependent and also "offers" me some
code maintenance nightmare.
Thanks a lot and
best regards,
Manfred
[quoted text, click to view] "Chris Jobson" <chris.jobson@btinternet.com> wrote in message
news:%23qxrkiPcGHA.4900@TK2MSFTNGP02.phx.gbl...
>> I think, there is a bug in the System.Console class related to use the
>> STDIO streams. I am doing a very simple thing in a console-based program
>> named CS [ConsoleTest]
>>
>> Console.In.Peek();
>>
>> and the program hungs if no parameters were provided on the commandline.
>> If I use simple redirection like "echo "hallo" | cs.exe"
>> everything is fine.
>
> Not sure, but I think the article at
>
http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraskdr/html/askgui07152003.asp
> might help.
>
> Chris Jobson
>