Warning: Undefined array key "view" in /var/www/html/wp-content/uploads/classes/so/1617/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/1617/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1617/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/1617/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1617/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/1617/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1617/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/1617/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1617/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/1617/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1617/lab-examples/index.php on line 51
/** * un programma, lanciato due volte come trasmittente e ricevente, * comunica tramite una pipe con nome sul file-system (FIFO); * da invocare come: * - trasmittente: fifo T * - ricevente: fifo R * * tentano di scambiarsi messaggi di dimensione variabile * (dimostrando i limiti delle pipe/fifo) */ #include #include #include #include #include #include #include #define BUFSIZE 1024 #define NUM_MSG 20 int main (int argc, char *argv[]) { int i, fd, len; char buffer[BUFSIZE]; const char *pathname = "/tmp/fifo"; if (argc < 2) { fprintf(stderr, "uso: %s T|R\n", argv[0]); exit(1); } if (argv[1][0] == 'T') { // trasmittente if (mkfifo(pathname, 0777) == -1) { perror(pathname); exit(1); } if ((fd = open(pathname, O_WRONLY)) == -1) { perror(pathname); unlink(pathname); exit(1); } for (i=0; i