Executing the following C code
#include <stdio.h> int main(int argc, char **argv) { char stdinput[10]; while (1) { fgets(stdinput, 10, stdin); fputs(stdinput, stdout); } }
gives:
Console:
./a.out input input
and then expects more input. That is, it repeats stdin for stdout, similar to cat .
On the channel:
echo input | ./a.out input input input [...]
after launch, it floods the console on its own, without interaction.
This sample program is exactly what I used for the tests; this is not a segment. I would expect the two tests to behave the same. What's happening?
source share