Reading binary data in C#
If you’re reading binary data from streams using syntax similar to the following, you’ll need to make sure to read this article. This code is not at all guaranteed to work.
1
2
3
4
5
6
byte[] buffer = null;
using (Stream strm = File.OpenRead(filename))
{
buffer = new byte[strm.Length];
fs.Read(buffer, 0, buffer.Length);
}
This post is licensed under CC BY 4.0 by the author.