Skip to main content
better title
Link
ctrl-alt-delor
  • 28.8k
  • 11
  • 66
  • 113

Interacting with binary throughprograms stdin and stdout (create a robot program to play a game)

Highlighted the terminologies.
Source Link
AdminBee
  • 23.6k
  • 25
  • 55
  • 77

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.

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

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.

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 stdoutstdout, for me to calculate, when I have done my calculation I can give my answer on stdinstdin 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 BashBash and a C-compilerC-compiler. What is the easiest way to interact with this program?

What I have done so far: I have been looking at pipes in CC, and have a little program running where I fork the process and use pipes to communicate between the two processes. (something like this program[program][1])But I cannot get this to work when i call an external binary from the child process.

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.

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

Source Link
Hogfeldt
  • 306
  • 2
  • 8
Loading