Tema: Re: Reikia pagalbos C#
Autorius: Tomis
Data: 2010-08-31 14:23:01
>
> typedef union {
>     struct {
>         int bReady:1;
>         int bAuto:1;
>         .
>         :
>     } flags;
>     int raw;
> } TankStatus;
> .
> :
> Tank.raw=StatusDWORD;
> if (Tank.flags.bReady)
>     .
>     :

Aciu, minti pagavau. Pasirasiau pagal pateikta pavyzdi, bet ties eilute

     if (Tank.flags.bReady) .....

Meta klaidas: error(004a) : unknown struct/union member ir error (0066): "  
is not a function

auksciau ties Tank.raw = 0x1234; klaidos nemeta. Tai kaip ir su struktura  
viskas tvarkoj?

Sorry kad taip klausineju uzuot google studijaves - terminai spaudzia.

Zemiau kodas, kuri dar biskeli pamodifikavau pagal pavyzdi is google (meta  
ta pacia klaida).


typedef struct {
        unsigned long bReady:1;
        unsigned long bAuto:1;
        unsigned long bAuto2:1;
        unsigned long bAuto3:1;
        unsigned long bAuto4:1;
        unsigned long bAuto5:1;
        unsigned long bAuto6:1;
        unsigned long bAuto7:1;
        unsigned long bAuto8:1;
        unsigned long bAuto9:1;
        unsigned long bAuto10:1;
        unsigned long bAuto11:1;
        unsigned long bAuto12:1;
        unsigned long bAuto13:1;
        unsigned long bAuto14:1;
        unsigned long bAuto15:1;
        unsigned long bAuto16:1;
        unsigned long bAuto17:1;
        unsigned long bAuto18:1;
        unsigned long bAuto19:1;
        unsigned long bAuto20:1;
        unsigned long bAuto21:1;
        unsigned long bAuto22:1;
        unsigned long bAuto23:1;
        unsigned long bAuto24:1;
        unsigned long bAuto25:1;
        unsigned long bAuto26:1;
        unsigned long bAuto27:1;
        unsigned long bAuto28:1;
        unsigned long bAuto29:1;
        unsigned long bAuto30:1;
        unsigned long bAuto31:1;
    } bitsai;

typedef union {
       bitsai flags;
       unsigned long raw;
} TankStatus;

BOOL aa;
TankStatus Tank;
Tank.raw=0x114;
aa=FALSE;
if (Tank.flags.bAuto) {
aa =TRUE;
}