message queue - System V MQ Text Length Issue -
i'm trying write simple chat app system v mqs having problem mtext value in struct.
struct join_buf { long mtype; char mtext[8]; };
when sent message struct inserted. written in server correct , wrong. see that; number of chars fullfilled 8.
what recommend me read mtext correctly ?
i think found mistake doing.
for (i = 0; < namelength; i++) { joinbuf.mtext[i]=argv[1][i]; } joinbuf.mtext[i]='\0';
without last line end of string length of char array. adding telling runtime it! not 1 bit more!
Comments
Post a Comment