2 module Main(main) where
5 import Directory ( removeFile, doesFileExist )
9 hFlush stdin `catch` \ _ -> putStrLn "No can do - flushing read-only handles isn't legal"
14 hdl <- openFile "io029.hs" ReadMode
15 hFlush hdl `catch` \ _ -> putStrLn "No can do - flushing read-only handles isn't legal"
18 hdl <- openFile "io029.out" WriteMode
22 hdl <- openFile "io029.out" AppendMode
26 hdl <- openFile "io029.out" ReadWriteMode
30 f <- doesFileExist "io029.out"
31 when f (removeFile "io029.out")