Oussama Guessoum
Oussama Guessoum

Reputation: 63

How to redirect the continuous output of a command to the input of a program writtten in c

I am running a program called argus which sniffs packets and extracts some features from every flow of packets and prints them to the terminal. the output is continuous and won't stop until you kill the process.

I am trying to redirect this output to a program written in c. I would like to execute a set of tests on every line obtained from the sniffing program.

How can i redirect the continuous output of the sniffing program and input it to the processing program?

Upvotes: 0

Views: 346

Answers (1)

9000
9000

Reputation: 40894

Read stdin in your program.

Then use a shell pipe to redirect the stdout of one command to the input of another:

sniffer | ./your_program

Upvotes: 2

Related Questions