[Haskell-cafe] After `readFile`, why cannot i `writeFile` ?

zaxis z_axis at 163.com
Sat Jun 5 22:39:06 EDT 2010


hitSSQ :: String -> [Int] -> IO ()
hitSSQ no hitNum = do
    let newNum = unwords $ [no] ++ map (\n -> show n) hitNum
    hitNums <- fmap lines $ readFile "test.txt"
    writeFile "test.txt" $ unlines $ hitNums ++ [newNum]

*** Exception: test.txt: openFile: resource busy (file is locked)


Sincerely!

-----
e^(π⋅i) + 1 = 0
-- 
View this message in context: http://old.nabble.com/After-%60readFile%60%2C-why-cannot-i-%60writeFile%60----tp28793133p28793133.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list