I have to create a program that do this
start another existing program
capture the standard output of the previos program and depending on what it print, it do something else.
I will try to explain the situation with an example:
Let's think that I have a program (example.c) that print a sequence of number (from 1 to 1000).
I have to create a program that start the "example.c" program and read the output continuously, so, when it print the number 348, it stop the example program!
I could separate the two processes (caller and example) with a fork, but I don't know how to analyze continuously the output!
Is there someone that can help me?
Thank you very much!