| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Basic C syntax |
In the function msg_receive, fd is a socket connected to a remote
Internet client.
What is wrong with msg_receive? Suggest a fix.
#define MAXVALS 65536
typedef struct _msg_t {
unsigned int num;
unsigned int values[MAXVALS];
} msg_t;
int msg_receive(int fd, msg_t *m)
{
size_t sz = sizeof(unsigned int);
assert(m);
if( read(fd, (void *)&m->num, sz) < sz)
return -1;
return read(fd, (void *)&m->values, sz * m->num);
}
þ CMPQwk 1.42 999
--- Maximus/2 3.01
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)SEEN-BY: 633/267 270 @PATH: 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™.