1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <stdio.h> #include <unistd.h> int main() { int test[2]; pipe(&test); char buf[] = "123"; char buf2[4]; write( test[1], buf, sizeof(buf) ); printf("lol\n"); read( test[0], buf2, sizeof(buf2) ); printf("answer: %s\n", buf2); }