BUT2/SCR/TP05/ex1.c

17 lines
303 B
C
Raw Normal View History

2023-10-12 16:39:49 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char* argv[]){
int t[2];
char p;
int nbchar = 0;
pipe(t);
while (write(t[1],&p,sizeof(char)) > 0){
nbchar ++;
printf("%d\n",nbchar);
}
close(t[0]);
close(t[1]);
return 0;
}