ReadFloat - Reading a 2-Byte float in C#

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.
 
C

cody

There is no floating point datatype in C# with 2 bytes. Instead you can read
a short and reinterpret its bits however you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top