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 "hFlush001.hs" ReadMode
15 hFlush hdl `catch` \ _ -> putStrLn "No can do - flushing read-only handles isn't legal"
18 hdl <- openFile "hFlush001.out" WriteMode
22 hdl <- openFile "hFlush001.out" AppendMode
26 hdl <- openFile "hFlush001.out" ReadWriteMode
30 f <- doesFileExist "hFlush001.out"
31 when f (removeFile "hFlush001.out")