Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > Cappy2112 <[EMAIL PROTECTED]> wrote: > >there is a bitfiled mainpulator class inthe Cookbook, but I don't > >understand his explanation, and the example given doesn't really show > >off the features of the class. > > I assume you're talking about the struct module? If you give an > example of the C struct you're trying to read/write, I could come up > with some sample code to do it.
struct S { unsigned int a : 1; unsigned int b : 1; unsigned int c : 1; unsigned int d : 1; }; fread(from file (file written by Python app) into an instance of struct S) then I want it to be used as follows: if (instance.a) f(); if (instance.b) g(); struct S comes out to 4 on my arch. I do not want to use a new int for every member of struct S. -- http://mail.python.org/mailman/listinfo/python-list