Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/signal.h>
- #include <fcntl.h>
- main()
- {
- int d, i, n;
- int o, p;
- char buf [2];
- d=open ("/home/banksy/Desktop/TP2/mypipe1", O_RDWR);
- if (d<0) {
- printf ("Problème de lecture du pipe\n");
- exit (0);
- }
- n=read (d, buf, 2);
- printf("Affichage du contenu du pipe\n");
- o=buf[0];
- o=o*2;
- p=buf[1];
- p=p*2;
- printf("Les valeurs sont %d et %d", o, p);
- printf("\n");
- }
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/signal.h>
- #include <fcntl.h>
- main() {
- int d, i, n;
- char buf [2];
- d=open("/home/banksy/Desktop/TP2/mypipe1", O_RDWR| O_NDELAY);
- if (d<0){
- printf ("Problème d'ouverture du pipe \n");
- exit (0);
- }
- buf[0]=1;
- buf[1]=2;
- if ((n=write(d, buf, sizeof(buf)))>0) {
- printf ("Ecriture effective %d\n",n);
- exit (0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement