Erreur lors de la communication sur une queue msg

J’ai fait une queue de messages, mais lorsque l’assistant envoie le message à son client, le client a reçu un mauvais numéro: -1081388352. C’est pour chaque numéro que j’envoie. Il n’y a pas d’erreur pendant le msgget et même durign msgcrv ou msgsnd. Le code pour l’envoi:

key_t chiave_ac = ftok("prenotazione.c", 'M'); if(chiave_ac == -1){ perror("ftock"); exit(EXIT_FAILURE); } int coda_ac = msgget(chiave_ac, IPC_CREAT | 0642); if(coda_ac == -1){ perror("msgget"); exit(EXIT_FAILURE); } if (msgsnd(coda_ac, &m, sizeof(messaggio)-sizeof(long), 0) == -1) { perror("msgsnd"); exit(EXIT_FAILURE); } 

Recivied:

 key_t chiave_ac = ftok("prenotazione.c", 'M'); if(chiave_ac == -1){ printf("Errore nel generare la chiaveAC \n"); perror("ftok"); exit(1); } int id_ac = msgget(chiave_ac, 0); if (id_ac == -1){ perror("msgget ac"); exit(EXIT_FAILURE); } if( msgrcv(id_ac, &risp, sizeof(messaggio)-sizeof(long), getpid(), 0) == -1){ printf("errore ricezione \n"); fflush(stdout); } 

Qu’est-ce que je fais mal? Il y a une erreur dans un drapeau?


[ajouté à partir du commentaire:]

 typedef struct { long type; int pid; scelta tipo; int aula; int giorno; bool finito; } messaggio;