[project @ 1999-12-29 14:46:29 by simonpj]
[ghc-hetmet.git] / ghc / tests / io / should_run / io029.hs
1 -- !!! Flushing
2 module Main(main) where
3
4 import IO
5 import Directory ( removeFile )
6
7 main = do
8   hFlush stdin `catch` \ _ -> putStrLn "No can do - flushing read-only handles isn't legal"
9   putStr "Hello,"
10   hFlush stdout
11   putStr "Hello - "
12   hFlush stderr
13   hdl <- openFile "io029.hs" ReadMode
14   hFlush hdl `catch` \ _ -> putStrLn "No can do - flushing read-only handles isn't legal"
15   hClose hdl
16   hdl <- openFile "io029.out" WriteMode
17   removeFile "io029.out"
18   hFlush hdl
19   hClose hdl
20   hdl <- openFile "io029.out" AppendMode
21   removeFile "io029.out"
22   hFlush hdl
23   hClose hdl
24   hdl <- openFile "io029.out" ReadWriteMode
25   removeFile "io029.out"
26   hFlush hdl
27   hClose hdl