Some months ago I posted code that implemented functions for accessing variables as bit-arrays. At that time somebody had a problem much like yours. Oops, that was me. I do apologise to the list for repeating the question. I even cut and paste your code below into my docs for later use. Thanks again Ex.: void SetBit( char *v, int n ) { v[n>>3] |=3D 1 << ( n & 7 ); } void ClrBit( char *v, int n ) { v[n>>3] &=3D ~( 1 << ( n & 7 )); } int ReadBit( char *v, int n ) { return ( v[n>>3] & ( 1 << ( n & 7 ))) ? 1 : 0; } 2009/11/25 Isaac Marino Bavaresco > Some months ago I posted code that implemented functions for accessing > variables as bit-arrays. > At that time somebody had a problem much like yours. > > Perhaps you can find the original thread in the archives. > > Best regards, > > Isaac > > > Justin Richards escreveu: > > Thanks Bob, > > > > struggling to understand here but I guess would use it like > > > > if (bitof(days.day,tm_wday)) > > { > > do something > > } > > > > and if tm_wday =3D 1 (monday) > > > > it expand to > > > > if(((bitv *)&(days.day))->b1) > > > > and now I am lost. What is bitv and how can I break it down further. > > > > Cheers Justin > > 2009/11/25 Bob Blick > > > > > >> You might be able to use this to help you access bits: > >> > >> #define _paste(a,b) a##b > >> #define bitof(var,num) (((bitv *)&(var))->_paste(b,num)) > >> > >> Cheers, > >> > >> Bob > >> > >> -- > >> http://www.piclist.com PIC/SX FAQ & list archive > >> View/change your membership options at > >> http://mailman.mit.edu/mailman/listinfo/piclist > >> > >> > >> ----------------------------------------------------------------------= -- > >> > >> > >> Nenhum virus encontrado nessa mensagem recebida. > >> Verificado por AVG - www.avgbrasil.com.br > >> Versao: 9.0.709 / Banco de dados de virus: 270.14.80/2523 - Data de > Lancamento: 11/24/09 05:46:00 > >> > >> > > __________________________________________________ > Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger > http://br.beta.messenger.yahoo.com/ > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist