Warning: Undefined array key "view" in /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php on line 47

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php on line 48

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php on line 50

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1718/lab-examples/index.php on line 51
/** * prova di invio di un messaggi in una coda (senza ricezione) */ #include #include #include #include #include #define DIM_MSG 1024 typedef struct { long mtype; char mtext[DIM_MSG]; } msg; int main() { int ds_coda; key_t chiave = 40; msg messaggio; // crea la coda if ((ds_coda = msgget(chiave, IPC_CREAT | IPC_EXCL | 0660)) == -1) { perror("msgget"); exit(1); } // crea ed inserisce il messaggio messaggio.mtype = 1; strncpy(messaggio.mtext, "Hello world!", DIM_MSG); // if (msgsnd(ds_coda, &messaggio, sizeof(messaggio)-sizeof(long), // IPC_NOWAIT) == -1 ) { if (msgsnd(ds_coda, &messaggio, strlen(messaggio.mtext) + 1, IPC_NOWAIT) == -1) { printf("Errore durante l'inserimento del messaggio.\n"); exit(1); } msgctl(ds_coda, IPC_RMID, NULL); }