How to find out the number of bits read from a stream or an array of bits? #252
-
Hello! I would like to know, how could I find out the number of bits read from a file using constbitstraem or BitArray?
|
Beta Was this translation helpful? Give feedback.
Answered by
scott-griffiths
Feb 20, 2023
Replies: 1 comment 1 reply
-
There is a So in short you can just use |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Foxiks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a
pos
attribute on bitstrings that support reading, which gives the current bit position. So you can look atstream.pos
before and after a set of reads to see how much has been read. This isn't supported for theBits
orBitArray
classes as you can't treat them like a stream.So in short you can just use
stream.pos
to get a bit position.