Valwex
❔ Read bits from a byte[] array
Hi, I was looking for a way to read bits in a byte[] array and advance the position, and I came across the BitStream library (https://github.com/Sewer56/Sewer56.BitStream) because we can't do it natively in C#.
The problem is that I've noticed that I'm not getting the expected behavior in my code
At first, I need to read an int32 in my byte stream, so I did :
And in output I get :
Normally I'd get something shorter like this:
I don't want to write a code that will only retrieve the first two characters because I don't necessarily know the size
Do you know why the BitStream library reacts like this? When I use MemoryStream + BinaryReader it works perfectly except that I get stuck when I have to read bits in a stream...
Thanks a lot 🙏
55 replies