[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] Using pipes for the GTP mode
From: |
Gunnar Farnebäck |
Subject: |
Re: [gnugo-devel] Using pipes for the GTP mode |
Date: |
Tue, 30 Sep 2008 17:14:33 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.16 (X11/20080724) |
Jorge Timón wrote:
> I readed some old mails in the mailing list. Now i know what i need is
> pipes. I found some examples
>
(http://lists.gnu.org/archive/html/gnugo-devel/2005-03/msg00052.html)(http://svn.gna.org/viewcvs/quarry/trunk/src/gtp/).
> I think that's too complex for me: i just need a little example in wich
> "gnugo --mode gtp" is runned, a command is sent to it and the response
> is received (from a piece of code, not the shell). Maybe i should read
> more about pipes before asking this, but there are various types of
> pipes, aren't there? If i'm asking for too much and i have to learn that
> on my own, just tell me.
Establishing pipes from C code is unavoidably somewhat unpleasant, I'm
afraid, but there are probably good tutorials to find somewhere on the
net.
There is a trick on unix (including linux but unsure about cygwin) to
avoid this at the expense of having the unpleasantness moved to the
time of running the code. Just write your code talking GTP via
stdin/stdout. Then run the program in this way:
mkfifo pipe
gnugo --mode gtp < pipe | ./your_program > pipe
/Gunnar