Standard input and output (using C programs)

Asked

Viewed 46 times

1

I have a program that prints something, and another that reads something and prints another, I wonder if it has how to connect the output of one with the input of another.

The gambit I did was, pass the exit of one to txt, and then I asked the other to read this txt, as follows:

 ./teste > texto.txt; ./1024 < texto.txt

Entrada e saída padrão

Is there any way to do this directly? For example:

./teste > ./1024 (dessa maneira não funciona)

1 answer

1


Use the pipe(|) operator. It does just what you need: takes the output of one program and uses it as input from another:

./teste | ./1024

Browser other questions tagged

You are not signed in. Login or sign up in order to post.