Message-ID: <38E1019E.B5E2F47C@corel.com> Date: Tue, 28 Mar 2000 14:01:50 -0500 From: Jonathan Meunier X-Mailer: Mozilla 4.7 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: help with a bit stream.... References: <38E0FCF9 DOT AB82C211 AT gtcom DOT net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 120.150.3.42 X-Trace: 28 Mar 2000 14:00:56 -0500, 120.150.3.42 Lines: 43 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Read one byte at a time, then simply AND this byte for each bit you want to read.. eg: #define BYTE char BYTE read_bit( BYTE byte_to_process, BYTE which_bit ) { return ( byte_to_process & ( 1 << which_bit ); } int main() { ... byte = fread(...); // or whatever function you use bit = read_bit( byte, x ); ... } HTH, .(Trancelucid). . Jaune . Krogg wrote: > > I can open FILEs and read them one byte at a time but i > really want to read them one BIT at a time...Is there > a nice way to do this?... > > something like this.. > > //------------- > > while( (x=next_bit_in(MY_FILE))!=EOF) ; > { > process_this_bit(x); > } > > //--------------- > > Thanks....