[project @ 2001-05-21 15:25:24 by simonmar]
[ghc-hetmet.git] / ghc / tests / lib / IOExts / hTell002.hs
1 -- !!! Testing hSeek
2 module Main(main) where
3
4 import IO
5 import IOExts
6 import Directory
7
8 main :: IO ()
9 main = do
10   h <- openFile "tst-seek" WriteMode
11   hPutStr h "test string1"
12    -- seek to EOF should be cool..
13   hSeek h SeekFromEnd 0
14   hPutStr h "test string2"
15    -- seek past EOF should now also be cool..
16   hSeek h SeekFromEnd 3
17   hPutStr h "test string3"
18   hSeek h AbsoluteSeek 13
19   hPutStr h "test string4"
20   x <- hTell h
21   print x
22   hPutStr h "filler"
23   hClose h
24   ls <- readFile "tst-seek"
25   putStrLn ls
26   removeFile "tst-seek"