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). But I cannot get this to work when i call an external binary from the child process.

bcutility available?1970-05-05T15:32:32+0000and you should parse it to the following formatY-m-d H:M:S UTC. The formats changes, so you should detect the format every time and parse it correctly.bcis available.expect?expectis available, but can dynamically use it to generate answers? I was of the impression that it was for a more static use.