[cs631apue] Weird Output when use pipe
bzhang41
bzhang41 at stevens.edu
Sun Dec 4 01:06:51 EST 2016
Hi all,
I am a little confused why the output my program is not stable I when I
try to use pipe.
If I test separately,
./aed -e <file >file.enc
./aed -d <file.enc
I always get the correct answer:
Hi Alice, I am Bob !
Hi bob!
However, interesting thing happened when I use pipe, each time I try, it
will
output different result, sometimes it is correct, sometimes it is not.
The
following is the output of the test:
bzhang41 at nemo:~/hw4$ cat file | ./aed -e | ./aed -d
?r?}??? , I am Bob !
Hi bob!
bzhang41 at nemo:~/hw4$ cat file | ./aed -e | ./aed -d
`???*, I am Bob !
Hi bob!
bzhang41 at nemo:~/hw4$ cat file | ./aed -e | ./aed -d
????T??, I am Bob !
Hi bob!
bzhang41 at nemo:~/hw4$ cat file | ./aed -e | ./aed -d
Hi Alice, I am Bob !
Hi bob!
bzhang41 at nemo:~/hw4$ cat file | ./aed -e | ./aed -d
Hi Alice, I am Bob !
Hi bob!
bzhang41 at nemo:~/hw4$ cat file | ./aed -e | ./aed -d
S?pYY?e, I am Bob !
Hi bob!
bzhang41 at nemo:~/hw4$ cat file | ./aed -e | ./aed -d
?8?R?J, I am Bob !
Hi bob!
bzhang41 at nemo:~/hw4$ cat file | ./aed -e | ./aed -d
Hi Alice, I am Bob !
Hi bob!
More information about the cs631apue
mailing list