The extra byte probably means that each of the bit fields is being stored in its own byte, rather than both being fitted into the same byte. Bit fields are one of the least compatible features of C.
-------Original Email------- Subject :Re: [nlug] Mag-Stripe Reader, Part 2 >From :mailto:[email protected] Date :Sun Oct 24 22:54:29 America/Chicago 2010 On Sun, Oct 24, 2010 at 9:16 AM, Jamie Faris <[email protected]> wrote: > Comments below... > > On Sun, Oct 24, 2010 at 3:32 AM, Paul Boniol <[email protected]> wrote: > ... >> >> BYTE btNumBytesReceived : 3; >> BYTE btReserved1 : 5; >> >> These lines appear to be the reverse of the order I'm seeing the data >> in. Of course they could have accidentally reversed the lines when >> writing it up. >> > > This is a bit field in C: > > http://en.wikipedia.org/wiki/C_syntax#Bit_fields > > The reversed order you are seeing is probably due to endianness > issues. Really experimentation the best way to figure out exactly how > a compiler orders bit fields on a specific platform. > > HTH, > > Jamie Thanks! I thought it was perhaps mapping bits, but from what I saw this means I'm getting one extra byte from what is documented for each packet... This "quick" project has taken more of my time than I would have ever anticipated, all to "possibly survey students who came to the office". I'll let it run with the code I wrote and see how it works. Paul -- You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en Sent from my Verizon Wireless BlackBerry -- You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en
