First of all, sorry, if this question violates any guideline /nettiqutte. I am acting on my own understanding.
I have the initial c++ code, call it alpha.cpp, I want to call an external program with sytem() (i have linux 64 bit, g++ ), the external program can be either an input text parser written in D, or another parser written in Perl, or the software openaxiom with scriptfile. This external program will write to a particular file, call it beta.file. Now alpha.cpp will be paused while the external pogram runs, right?
Is there an way to monitor the beta.file while the externl program runs, from inside alpha.cpp? i.e. say, openaxiom writes in file : "prüfer code of input tree-graph is xyz" alpha.cpp notes this update infile, and changes a state variable, meanwhile openaxiom proceeds with next tree-graph.
I can call two processes, and let them interact to each other, and when things end, i can get all info back to alpha.cpp. Is there any other way?
Sorry if this question is stupid. I tried to post this in stackoverflow, but was below quality standards
program alpha pipes to openaxiom which pipes to a monitor program and then to file
alpha | openaxiom | monitor > beta.file
monitor is just a simple program that reads from stdin and writes to stdout, but it has a peek at the data on the way, and under appropriate conditions send a signal to alpha
alpha receives the signal and runs an interrupt handler that changes the internal state
1. alpha can receive a signal at any time, including when it might be halfway through using the internal state data to do something
2. Is there data to be communicated back to alpha? - I don't think signals can carry much data (might be wrong there)
On the alpha program side you can mask signals temporarily while it updates its state. You need to write a signal handler (there are two free signal types in unix USR1 and USR2, you could use one of these).
The interrupt handling routine needs to be short, just a few lines, then you should not get signals pileing up because of more being recieved when alpha is in the signal blocked state.