Mail Archives: djgpp/2000/03/29/01:30:17
Trancelucid wrote:
>
> I don't think it's possible to retrieve only one bit from a file.. it
> must be at least the smallest memory type size, which is a byte.
> If you
> know how many bits you want to read in advance (let's use 22 as an
> exemple), then you could load a factor of this (eg: 22bits * 4 = 88bits
> == 11 bytes) into a buffer, and work with this buffer. If you don't know
> in advance, then your algorithm might become complex (or slow, or
> both...) What is it for anyway? Maybe knowing the use for such an
> algorithm would help finding a better way to do it.
>
> I doubt the snippets retrieve only one bit at a time, but if they do,
> please post its location..
Thats not what i am saying...It does retrieve one byte at a time
from the actual file but it provides a function that spits out
one bit at a time via an int.....You open the file with bfopen()
and retrieve the next bit with bfread()...the functions takecare
of keeping up with what bit from whatever byte its got in the buffer.
It also allows you to write to a file in the same way...
I am trying to use this stuff to meddle with compression
of files..most of the time you need to retrive data
in varible length bit patterns.
I was hoping to find a better documented method or some
canned code.......I am going to rework the code myself
that i found in the snippets....
--
|"""""<`.THE PRINCE ,'>"""""""""""""""""""""""""""""""""""|
| `.`/""""""\,',' my sig is too big, |
|SEE HIS ( / \ \' SEE HIS but its really cool. |
| FACE \/<> <>\/ SMILE |
| / W \ Visit my ascii art site: |
| ,'\_|||||_/`. http://www.gtcom.net/~krogg/ascii/ |
| ,',' ||| `.`. krogg DOT no DOT to DOT spam AT gtcom DOT net |
|____<,' TIME TO DIE `.>____Remove no.to.spam to reply____|
- Raw text -