imam problem
Naime, šaljem poruke između procesa u linuxu i sad želim slati samo jedan znak -> jedan char
imam:
Code:
struct my_msgbuf {
long mtype;
char mtext[1];
};
...
for(;;)
if (msgrcv(msqid, (struct msgbuf *)&buf, sizeof(buf), 0, 0) == -1) {
perror("msgrcv");
exit(1);
}
printf(" -> Poruka primljena (<<): \"%s\". \n", buf.mtext);
}
struct my_msgbuf {
long mtype;
char mtext[1];
};
...
for(;;)
if (msgrcv(msqid, (struct msgbuf *)&buf, sizeof(buf), 0, 0) == -1) {
perror("msgrcv");
exit(1);
}
printf(" -> Poruka primljena (<<): \"%s\". \n", buf.mtext);
}
char mtext[] je problematičan, prva verzija primala je veće poruke recimo mtext[100] i to je ok, no sad kad promijenim u char mtext onda mi javi segmentation error.. ?
Ima li kakvih ideja (to su slavni spock.c i kirk.c )