[Haskell-cafe] using an external application

jerzy.karczmarczuk at info.unicaen.fr jerzy.karczmarczuk at info.unicaen.fr
Fri Nov 2 04:27:16 EDT 2007

Petr Hoffmann writes: 

> I'm solving the following problem - I need to use an external
> application - give it the input data and receive its output.
> However, when multiple calls are made, the results are not
> as expected. The simplified version of the problem is given
> below:

>          System.Cmd.system "echo hello >output.txt" -- use the external  
>          System.Cmd.system "echo bye >output.txt" -- the second call to  
> the external application
>          o2 <- readFile "output.txt"
>          putStr o1 -- "hello" expected, but "bye" printed

> Can you please give me some hint to solve this problem?
> I'm a beginning haskell developer and I'm still a bit confused
> by the IO monad.

I have the impression that your problem has nothing to do do
with Haskell, you just rewrite your file, instead of appending to it.
But perhaps I didn't look correctly... 

Jerzy Karczmarczuk 

More information about the Haskell-Cafe mailing list