| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | More silly questions |
SA> struct MESSAGErecord
SA> {
SA> // other stuff
SA> unsigned char Attribute;
SA> /* Bit 0 : Enable EchoInfo
SA> 1 : Combined access
SA> 2 : File attaches
SA> 3 : Allow aliases
SA> 4 : Use SoftCRs as characters
SA> 5 : Force handle
SA> 6 : Allow deletes
SA> 7 : Is a JAM area */
SA> // more stuff
SA> };
SA> Simple question. How do I modify the values?
Let's simplify things...
struct foo
{
unsigned char bar;
};
#define BAR_ENABLEECHOINFO 0x01 /* bit 0 'on' */
#define BAR_COMBINEDACCESS 0x02 /* bit 1 'on' */
#define BAR_FILEATTACHES 0x04 /* !!! - not 3! */ /* bit 2 'on' */
#define BAR_ALLOWALIASES 0x08 /* bit 3 'on' */
/* etc - 0x10, 0x20, 0x40, 0x80 */
struct foo f;
f.bar |= BAR_ENABLEECHOINFO; /* turn on bit 0 */
f.bar &= ~BAR_COMBINEDACCESS; /* turn off bit 1 */
if (f.bar & BAR_FILEATTACHES) /* if bit 2 is on... */
do_something();
f.bar ^= BAR_ALLOWALIASES; /* toggle bit 3 */
This is all no different from non-struct bit access.
Hope this helps.
---
* Origin: Tanktalus' Tower BBS (1:250/102)SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728 810 SEEN-BY: 639/252 670/213 218 @PATH: 250/102 201 99 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.