On 2008 Sep 23, at 7:55, Marc Weber wrote:
On Tue, Sep 23, 2008 at 01:37:56PM +0200, Janis Voigtlaender wrote:
assume I have a program taking input from stdin. How do I call it
from
Haskell while feeding to it a string as input.
Sure, have a look at
http://hackage.haskell.org/packages/archive/process/1.0.0.0/doc/html/System-Process.html#v
:runInteractiveProcess
rnuInteractiveCommand does would you want
(in,out,err,pId) <- runInteractiveProcess "cat" ...
hPutStrLn "test" in
hClose in
outContents <- hGetContents out
print outContents
Note that this will deadlock if either the input or the output is too
long; you should forkIO a thread to do either the input or the output.
--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university KF8NH
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe