| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Basic C syntax |
Hi Neil.
19-Apr-04 12:14:02, Neil Heller wrote to All
NH> In the function msg_receive, fd is a socket connected to a remote
NH> Internet client.
NH> What is wrong with msg_receive? Suggest a fix.
are you #including io.h ( for read())
NH> #define MAXVALS 65536
NH> typedef struct _msg_t {
NH> unsigned int num;
NH> unsigned int values[MAXVALS];
NH> } msg_t;
how wide is your size_t (16 bit compilers won't like that but they should
complain...)
NH> int msg_receive(int fd, msg_t *m)
NH> {
NH> size_t sz = sizeof(unsigned int);
NH> assert(m);
NH> if( read(fd, (void *)&m->num, sz) < sz)
what byte-order are you (and the sender) using
-=> Bye <=-
---
* Origin: As King Arthur said: Some days it all seems so feudal. (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™.