If you want to read one quint8 (8 bytes), each bit to a value in that
structure, you will have to use the bitwise operators or change that whole
structure into a single byte.
This isn't Qt Creator-related though, so I'll just point you to a page on
this: http://www.cprogramming.com/tutorial/bitwise_operators.html

On Fri, Dec 24, 2010 at 4:03 AM, Christian Kandeler <
[email protected]> wrote:

> On 12/24/2010 04:20 AM, ext Akos Zalavary wrote:
> > Hi,
> >
> > Is there an easier solution for this?
> >
> > E.g. checking the size of struct in bytes and force reading the same
> > amount of data into that from the file...
> >
> > Thanks!
> >
> > typedefstruct_Sl_based_funct_t{
> >
> >     /*  byte*/  unsigned   hypo_lac   :  1;
> >
> >     /*  byte*/  unsigned   page_prev   :  1;
> >
> >     /*  byte*/  unsigned   camel_prev   :  1;
> >
> >     /*  byte*/  unsigned   isp   :  1;
> >
> >     /*  byte*/  unsigned   emlpp_prev   :  1;
> >
> >     /*  byte*/  unsigned   ded_page_rnc   :  1;
> >
> >     /*  byte*/  unsigned   spare4   :  1;
> >
> >     /*  byte*/  unsigned   spare5   :  1;
> >
> >   }   l_based_funct_t  ;
> >
> >
> > ...and reading one quint8 into it.
>
> <cough>qt-interest</cough>
>
> Anyway, what's wrong with this:
>
> l_based_funct_t var;
> file.read(reinterpret_cast<char *>(&var), sizeof var);
>
>
> Christian
> _______________________________________________
> Qt-creator mailing list
> [email protected]
> http://lists.qt.nokia.com/mailman/listinfo/qt-creator
>



-- 
“Great things are not accomplished by those who yield to trends and fads and
popular opinion.” --Jack Kerouac
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-creator

Reply via email to