Thank you so much, Luca.
On 12/14/2010 07:24 AM, Sok H. Chang wrote:
Hello, everyone.Hello,
I don't understand very well what you're trying to do in your code, but if it is simply reading from a file and put the output into another file there is a better way:
import System.IO
import System.Random
sentenceAry = []
main :: IO ()
main = do
inh <- openFile "c:\\Documents and Settings\\shaegis\\inputFile.txt" ReadMode
outh <- openFile "c:\\Documents and Settings\\shaegis\\outputFile.txt" WriteMode
mainloop inh outh
hClose inh
hClose outh
mainloop :: Handle -> Handle -> IO ()
mainloop inh outh = do
ineof <- hIsEOF inh
if ineof
thenreturn ()hPutStrLn outh inpStr
else do
inpStr <- hGetLine inh
mainloop inh outh
I hope I've understood the problem.. In your code 'inpStr' wasn't in scope, because you've declared it only into else block..
Luca
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners