Tay Wee Wen
Tay Wee Wen

Reputation: 468

The Process Stream class does not support writing

I am trying to write something to a process using stream class. I am using .net 4.5. However it seems that writing is not support.

Process.StandardOutput.BaseStream.CanWrite 

return false.

Is it true that Process Stream class does not support writing?

Upvotes: 1

Views: 1199

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500445

Yes, because it's the output of the other process. You're only able to read from it. From the documentation.

Gets a stream used to read the output of the application.

I know it's a bit confusing, but think of it as StandardOutput from the perspective of the process. (Not from your perspective, as another process looking at it.)

If you want to write data for the other process to read, you'd use Process.StandardInput instead.

Upvotes: 7

Related Questions