C _ jak rozepsat řádek

Milan B. milan na bastl.sk
Sobota Duben 27 14:15:46 CEST 2013


zeby pProgEEpr->EndProgram = 1;

alebo

(*pProgEEpr).EndProgram = 1;

?

-m-

On 27. 4. 2013 12:18, Miroslav Draxal wrote:
>
> Dobrý den
>
> Mějme
>
> char MenuPolozkaSet;
>
> typedef union {
>
>     char value;
>
>     struct {
>
>                unsigned Bit0 : 1;
>
>                unsigned Bit1 : 1;
>
>                unsigned Bit2 : 1;
>
>                unsigned Bit3 : 1;
>
>                unsigned Bit4 : 1;
>
>                unsigned Bit5 : 1;
>
>                unsigned Bit6 : 1;
>
>                unsigned Bit7 : 1;
>
>     } Bits;
>
>     struct {
>
>                unsigned val : 7;
>
>                unsigned bit_ : 1;
>
>     } ProlnutiPauza;
>
>     struct {
>
>                unsigned Mesic : 5;
>
>                unsigned AutoOnOff : 1;
>
>                unsigned EndProgram : 1;
>
>     };
>
> } _ProgramEEprom;
>
> (*((_ProgramEEprom*) & MenuPolozkaSet)).EndProgram = 1; // tohle je OK
>
> Pokud bych to chtěl rozepsat přes fyzický ukazatel
>
> _ProgramEEprom *pProgEEpr = (_ProgramEEprom*) &MenuPolozkaSet;
>
> *pProgEEpr.EndProgram = 1;
>
> To hází chybu
>
> MenuKey.c:261: error: struct/union required
>
> MenuKey.c:261: error: illegal conversion between types
>
> Což asi chápu, ale jak to napsat. Snažím se tomu přijít na kloub. 
> V těch pointerech plavu.
>
>
>
> __________ Informace od ESET NOD32 Antivirus, verze databaze 8272 
> (20130426) __________
>
> Tuto zpravu proveril ESET NOD32 Antivirus.
>
> http://www.eset.cz
>
>
> _______________________________________________
> HW-list mailing list  -  sponsored by www.HW.cz
> Hw-list na list.hw.cz
> http://list.hw.cz/mailman/listinfo/hw-list

------------- další část ---------------
HTML příloha byla odstraněna...
URL: <http://list.hw.cz/pipermail/hw-list/attachments/20130427/fc72fb7e/attachment.htm>


Další informace o konferenci Hw-list