N
nick048
Hi to all,
I have this declaration:
struct node
{
char info[BUFLEN] ;
struct node *next ;
} ;
and in the main
char msg[BUFLEN];
After the initialition of string with (for example)
i=0;
char_recv = recv(newsocketfd, &c, 1, 0);
while (c !='\n')
{
msg[i++]=c;
char_recv = recv(newsocketfd, &c, 1, 0);
} /* End while (c !='\n') */
I need to insert msg into my list; if I write
p = malloc(sizeof(struct node));
p->info = msg;
p->next = first;
first = p;
the compiler return to me the message:
error: incompatible type in assignement
How can to correct the error ? I hope in Your help.
Best Regards
Gaetano
I have this declaration:
struct node
{
char info[BUFLEN] ;
struct node *next ;
} ;
and in the main
char msg[BUFLEN];
After the initialition of string with (for example)
i=0;
char_recv = recv(newsocketfd, &c, 1, 0);
while (c !='\n')
{
msg[i++]=c;
char_recv = recv(newsocketfd, &c, 1, 0);
} /* End while (c !='\n') */
I need to insert msg into my list; if I write
p = malloc(sizeof(struct node));
p->info = msg;
p->next = first;
first = p;
the compiler return to me the message:
error: incompatible type in assignement
How can to correct the error ? I hope in Your help.
Best Regards
Gaetano