Vitaly,
You don't want to do this. When you use a BinaryReader, it is not doing
a conversion when you read a double. When you call ReadDouble, it actually
reads four bytes, and takes that as the four byte representation of the
double.
The standard console stream is different. It is going to feed you
characters (hence the use of a TextReader to support it). The four bytes
that represent the double are going to look like garbage if you printed them
out on screen.
Instead, you want to read the line from the console, and then pass that
to one of the methods on the Convert class, to perform a conversion from a
string to a double.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Vitaly" <no****@ukr.net> wrote in message
news:dg***********@news.kiev.sovam.com...
// Open input file and create the BinaryReader.
br = new BinaryReader(new FileStream("Test.dat",
FileMode.Open,
FileAccess.Read));
// Read binary data.
d = br.ReadDouble();
A question is how to do the same but read from standard input stream …
like
Console.In.
How to Assign the BinaryReader to the standard input stream which actually
has type TestReader?
Any suggestion?