Is there any way to read binary data from stdin in C#?
In my problem I have a program which is started and receives binary data on stdin.
Basically:
C:>myImageReader < someImage.jpg
And I would like to write a program like:
static class Program
{
static void Main()
{
Image img = new Bitmap(Console.In);
ShowImage(img);
}
}
However Console.In is not a Stream, it's a TextReader.
(And if I attempt to read to char[], the TextReader interprets the data, not allowing me to get access to the raw bytes.)
Anyone got a good idea on how get access to the actual binary input?
Cheers,
Leif
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…