Something about Stream

Posted by sforester on Stack Overflow See other posts from Stack Overflow or by sforester
Published on 2010-05-29T05:51:53Z Indexed on 2010/05/29 6:12 UTC
Read the original article Hit count: 252

Filed under:
|
|

I've been working on something that make use of streams and I found myself not clear about some stream concepts( you can also view another question posted by me at http://stackoverflow.com/questions/2933923/about-redirected-stdout-in-system-diagnostics-process ).

1.how do you indicate that you have finished writing a stream, writing something like a EOF?

2.follow the previous question, if I have written a EOF(or something like that) to a stream but didn't close the stream, then I want to write something else to the same stream, can I just start writing to it and no more set up required?

3.if a procedure tries to read a stream(like the stdin ) that no one has written anything to it, the reading procedure will be blocked,finally some data arrives and the procedure will just read till the writing is done,which is indicated by getting a return of 0 count of bytes read rather than being blocked, and now if the procedure issues another read to the same stream, it will still get a 0 count and return immediately while I was expecting it will be blocked since no one is writing to the stream now. So does the stream holds different states when the stream is opened but no one has written to it yet and when someone has finished a writing session?

I'm using Windows the .net framework if there will by any thing platform specific.

Thanks a lot!

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET