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
posattribute on bitstrings that support reading, which gives the current bit position. So you can look atstream.posbefore and after a set of reads to see how much has been read. This isn't supported for theBitsorBitArrayclasses as you can't treat them like a stream.So in short you can just use
stream.posto get a bit position.