Message-ID: <38E1589D.A23FCDA1@gtcom.net> From: Krogg X-Mailer: Mozilla 4.61 [en] (Win95; U) X-Accept-Language: en-US,en-GB,en,ja MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: help with a bit stream.... References: <38E0FCF9 DOT AB82C211 AT gtcom DOT net> <38E1019E DOT B5E2F47C AT corel DOT com> <38E105BC DOT E528B7F0 AT corel DOT com> <38E12ED5 DOT 7205297F AT gtcom DOT net> <38E13966 DOT D7F7F643 AT videotron DOT ca> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 46 Date: Tue, 28 Mar 2000 20:13:01 -0500 NNTP-Posting-Host: 12.6.67.14 X-Trace: eagle.america.net 954292499 12.6.67.14 (Tue, 28 Mar 2000 20:14:59 EST) NNTP-Posting-Date: Tue, 28 Mar 2000 20:14:59 EST Organization: 24hoursupport.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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____|