1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <unistd.h> #include <stdio.h> int main() { char buff[100]; int pfd[2]; buff[0] = '\0'; pipe(pfd); if (fork()) write(pfd[1],"hello world", 12); fork(); read(pfd[0], buff, 100); printf("%s\n", buff); printf("goodbye\n"); } |
I2luY2x1ZGUgPHVuaXN0ZC5oPgojaW5jbHVkZSA8c3RkaW8uaD4KaW50IG1haW4oKQp7CiAgY2hhciBidWZmWzEwMF07CiAgaW50IHBmZFsyXTsKICBidWZmWzBdID0gJ1wwJzsKICBwaXBlKHBmZCk7CiAgaWYgKGZvcmsoKSkKICAgIHdyaXRlKHBmZFsxXSwiaGVsbG8gd29ybGQiLCAxMik7CiAgZm9yaygpOwogIHJlYWQocGZkWzBdLCBidWZmLCAxMDApOwogIHByaW50ZigiJXNcbiIsIGJ1ZmYpOwogIHByaW50ZigiZ29vZGJ5ZVxuIik7Cn0=
prog.c: In function ‘main’: prog.c:8: warning: ignoring return value of ‘pipe’, declared with attribute warn_unused_result prog.c:10: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result prog.c:12: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result prog.c:15: warning: control reaches end of non-void function
-
upload with new input
-
result: Success time: 0s memory: 1720 kB returned value: 8
hello world goodbye


