Re: C _ jak rozepsat řádek
Radovan Augustin
rado_augustin na yahoo.com
Sobota Duben 27 14:17:16 CEST 2013
Dobry den,
tecka ma vetsi prioritu nez dereference:
(*pProgEEpr).EndProgram = 1;
nebo
pProgEEpr->EndProgram = 1;
Radovan Augustin
________________________________
From: Miroslav Draxal <evik na volny.cz>
To: 'HW-news' <hw-list na list.hw.cz>
Sent: Saturday, April 27, 2013 12:18 PM
Subject: C _ jak rozepsat řádek
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/b1542bcf/attachment.htm>
Další informace o konferenci Hw-list