IPC con pipe di basso livello...
Von: Alexandros (niente_spam@chiedetemela.it) [Profil]
Datum: 06.05.2008 19:17
Message-ID: <lo0Uj.303726$%k.406309@twister2.libero.it>
Newsgroup: it.comp.os.linux.development
Datum: 06.05.2008 19:17
Message-ID: <lo0Uj.303726$%k.406309@twister2.libero.it>
Newsgroup: it.comp.os.linux.development
Rieccomi...
... ora alle prese con le pipe ...
( leggasi "pipe" in inglese, non in italiano... :) )
Ovviamente, c'ho il "solito" problemino...
Ho fatto un programmino che definire "idiota" è un complimento...
...ma non funziona!
Ecco:
/*creo una pipe*/
if (pipe(fd) < 0) {
perror("\n pipe error! ");
exit(EXIT_FAILURE);
}
/*creo un figlio*/
if ( pid=fork() < 0 ) {
perror("\n fork error! ");
exit(EXIT_FAILURE);
}
else if (pid!=0) { /*codice del padre*/
close(fd[0]);
write(fd[1], "Ciao", 4);
}
else { /*codice del figlio*/
close(fd[1]);
n=read(fd[0], buf, DIM);
write(STDOUT_FILENO, buf, n);
}
perchè non deve funzionare ? Mi sto avvilendo...
ah.. .l'output è nullo, ovvero non stampa na ceppa...
[ Auf dieses Posting antworten ]Antworten
- RedWiz (07.05.2008 00:06)
- Alexandros (07.05.2008 12:02)
- Giovanni (07.05.2008 14:10)
- u_boss55 (07.05.2008 16:23)
