Thanks for the answer. I'm still having issues with these things. Sorry for taking so much time to respond (this is a late-night hobby I'm developing, with no extensive background).
First, it's probably best to explain what I try to do.
basically, I have a (main) program that "creates" c-codes, compiles them, runs them with inputs and reads the outputs.
I use popen to get the stdout of these and analyze it.
The results are unexpected a-priory, meaning: infinite run-time, infinite stdout, no output at all etc.
I now measure the time from start to end and if it exceeds something like half a second I consider it "infinite", but I still have problems with reading of infinite outputs, and generally - knowing when the sub-process stopped (I want to analyze the data only after all of it is already given, now it's a FILE *).
the system command is good for that, but can't get access to the stdout...
If you have any ideas how this can be done, I would be very grateful!