
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-... :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] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH