Author: Robert Hyatt
Date: 09:52:51 06/04/02
Go up one level in this thread
On June 04, 2002 at 10:52:30, JW de Kort wrote: >Hi! > >I would like to include in my own program the possibility to play against a >winboard engine. I suppose this will not be very easy, but can someone give me >any help on how to communicate with an winboard engine from within my own >program? Of course i could use winboard but that is not what i want. > >I have just started to study the winboard source but can somebody give me hint >where is should look? > >thank in advance > >Jan Willem To talk to another program, you need to figure out how to connect that programs "stdin" to a pipe you create. You also need to figure out how to connect that program's "stdout" to a pipe you can read to get information from that program. In unix, you create a pair of pipes, then fork() to create a new process, then use dup2 to force the two pipes on top of stdin/stdout. After that, a simple "exec" will execute the second program and all output will come to one of the pipes, and all input to it must be written (by your program) into the other pipe. You can see how this is done in winboard pretty easily. But it is far easier (and better) to let winboard do the work. Otherwise _you_ will have to take over some of the winboard functionality such as maintaining the clock and telling the other program how much time both sides have left, as well as other things.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.