The setup:
I have an executable file, that I "cannot edit", since I don't have the source code.
When I execute the program it reveals a game, where it hands me some numbers via stdout, for me to calculate, when I have done my calculation I can give my answer on stdin and it will tell rather I got the calculation right or not. Then I get a new calculation and it all repeats.
The problem:
I could just manually play this game, but I would like to automate this with a program. The available tools on the system is Bash and a C-compiler.
What is the easiest way to interact with this program?
What I have done so far:
I have been looking at pipes in C, and have a little program running where I fork the process and use pipes to communicate between the two processes. (something like this [program][1]program)But. But I cannot get this to work when i call an external binary from the child process.
 
                