I need to build an simple console application that accepts a pipe as input. We are running Windows Server 2012. The data is coming from another application that is going to
When you use <
and >
with an application, the standard input and output streams (screen/keyboard interface) is replaced by a file stream.
You can use the regular Console.Read
and Console.ReadLine
commands to read from the stream specified by the <
directive, or use Console.In
which is a TextReader
.
Similarly Console.Write
and Console.WriteLine
can be used to write to the output stream specified by the >
directive, or Console.Out
which is a TextWriter
.
If you use the |
pipe directive, for example myapp.exe | sort
, the output stream of the first program goes into the input stream of the next program.