Why its not working?

Posted by Andrew Hoffmann on Stack Overflow See other posts from Stack Overflow or by Andrew Hoffmann
Published on 2010-12-31T14:30:10Z Indexed on 2010/12/31 14:53 UTC
Read the original article Hit count: 317

Filed under:
|
|
BinaryReader br = new BinaryReader(Console.OpenStandardInput());
BinaryWriter bw = new BinaryWriter(Console.OpenStandardOutput());

int n = br.ReadInt32();
bw.Write(n);

always getting this error:

Unhandled Exception: System.IO.EndOfStreamException: Failed to read past end of stream.
at System.IO.BinaryReader.FillBuffer (Int32 numBytes) [0x00000] in <filename unknown>:0 
at System.IO.BinaryReader.ReadInt32 () [0x00000] in <filename unknown>:0 
at Program.Main () [0x00025] in /home/skydos/ACM/Csharp/Csharp/Main.cs:24 

Is there any way to make reading data in C# faster from Console?

© Stack Overflow or respective owner

Related posts about c#

Related posts about data