Can i put binary in stdin? C#

前端 未结 2 864
难免孤独
难免孤独 2020-12-19 02:05

Related to this question encrypt binary with 7z without filenames?

In C# how can i put binary in STDin? i was hoping the below would work but it doesnt. And it makes

相关标签:
2条回答
  • 2020-12-19 02:36

    Write directly to the base stream:

    
    new BinaryWriter(p.StandardInput.BaseStream)
    
    0 讨论(0)
  • 2020-12-19 02:44

    stdin is just another byte stream, one your program can read from

    Stream st=Console.OpenStandardInput ();
    StreamReader sr=new StreamReader(st);
    

    etc. In the q. which you refer to, the material coming in from stdin is being piped from the output of another program. To do that part of the process, you use Console.OpenStandardOuput() to get a stream and push the binary out through that.

    0 讨论(0)
提交回复
热议问题