Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: reading/writing to stdout/stdin of another program?

Author: Robert Hyatt

Date: 21:21:26 05/22/02

Go up one level in this thread


On May 22, 2002 at 22:04:24, martin fierz wrote:

>aloha,
>
>i have written a checkers interface called "checkerboard" which uses dll's as
>checkers engines. since this approach is limited to windows, i would like to
>change things so that engines read and write to standard input and output and
>the interface reads and writes there. hmm - i just don't know how that is
>done... can somebody give me a tip? (can be very short, what kind of function
>that might be, i can then look it up in the f*** manuals).
>
>cheers
>  martin


In unix it is trivial to fork a new process, use pipe() and dup2() to
force stdin/stdout/stderr to use the pipe, then exec() another program
and have it use the pipe to talk to your program.

Apparently it is also possible in windows, but I am not a windows programmer.
Best/easiest bet is to look at winboard which does just what you want for
all the winboard-compatible chess engines...



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.