Communicating with other programs (Win32)
Wed, 5 Dec 2001 00:39:43 -0800
have a look at http://www.galois.com/~sof/subby.zip , it contains
a basic module, RunProc, which lets you kick off a Win32 sub-process
and communicate with it via Handles. The .zip file also contains
an example demonstrating how to use it.
Let me know if this addresses your problem.
----- Original Message -----
From: "Jan de Wit" <[email protected]>
To: <[email protected]>
Sent: Wednesday, November 28, 2001 06:38
Subject: Communicating with other programs (Win32)
> Hi all,
> In my free time, I'm writing a Go program in Haskell. Main platform is
> GHC and GHCi under Win32. It is coming along nicely: it has a GUI and the
> it comes up with are starting to make some sense. For testing (and maybe
> training :) purposes I want it to be able to play against GnuGo (the
> Open Source Go program) on its own.
> Currently, to get GnuGo to think up a move, I use something like (SGF is
> standard way of outputting Go games):
> | do writeFile "in.sgf" (showAsSGF game)
> | let cmd = "echo quit > gnugo --quiet --infile in.sgf --color " ++
> | (show computerColor) ++
> | " --mode ascii > out.txt"
> | system cmd
> | result <- readFile "out.txt"
> | return (parseResultMove result)
> I think this both ugly and inefficient: for every move a new instance of
> GnuGo gets started and an SGF file is output! Instead, I want
> to start GnuGo only once per game and communicate with it like a human
> would, by typing commands at it; or by using the Go Text Protocol which is
> specifically designed for computer-computer play.
> Does anybody here know a way - under Win32 - to start a process in the
> background and communicate with it via its stdin/stdout? I've poked around
> a bit in the Win32 library source, looking for an FFI interface to
> CreateProcess (the API function which does what I want) but found nothing.
> The Posix library looks like it should be up to the job, but
> unfortunately that isn't supported under Win32... (I'm not using Cygwin)
> Any help would be appreciated!
> Jan de Wit
> Glasgow-haskell-users mailing list
> [email protected]