ReadFloat - Reading a 2-Byte float in C#

  • Thread starter Thread starter aperion
  • Start date Start date
A

aperion

The System.IO.BinaryReader contains methods for reading almost every
basic data type except for 2-Byte floats. Does anybody know how to
read a 2-Byte from a file stream? There has to be a more efficient
way than to manually read the bits and encode them to a float.
 
There is no floating point datatype in C# with 2 bytes. Instead you can read
a short and reinterpret its bits however you want.
 
Back
Top