| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Basic C syntax |
Hi Bill.
09-May-04 12:31:00, Bill Birrell wrote to Neil Heller
BB> Answer: It has a typo on _msg_t. That's why it won't work.
>> #define MAXVALS 65536
>> typedef struct _msg_t {
>> unsigned int num;
>> unsigned int values[MAXVALS];
>> } msg_t;
BB> Given that m is a pointer to a structure of type _msg_t or msg_t (the
BB> code is not clear whether the underline is there or not)
the code seems clear to me...
"msg_t" is another name for "struct _msg_t"
it seems he could have left the word "_msg_t" out of the declaration as he
he doesn't seem to use it.
>> int msg_receive(int fd, msg_t *m)
[...]
>> if( read(fd, (void *)&m->num, sz) < sz)
[...]
>> return read(fd, (void *)&m->values, sz * m->num);
BB> , m->num or m->values is required, rather than &m->etc
m->num would get you the integer stored in that field of the structure
harrld aproprite for a call to read,
and &m->values gives the same address as m->values (the only difference is
the type)
BB> Fix: decide whether the initial underline is needed. 2) Use the
BB> pointer
BB> rather than the address of the pointer
-=> Bye <=-
---
* Origin: Success is a journey, not a destination. (3:640/1042)SEEN-BY: 633/267 270 @PATH: 640/1042 531 954 774/605 123/500 106/2000 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™.