summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/lib/IO/hSeek002.hs
blob: 8c9153cfaa15daa1ceaef40f88d12ec401d42698 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
-- !!! Testing EOF (and the clearing of it)

module Main(main) where

import System.IO
import System.Directory ( removeFile )

main :: IO ()
main = do
   hdl <- openFile "hSeek002.hs" ReadMode
   flg <- hIsEOF hdl
   print flg
   hSeek hdl SeekFromEnd 0
   flg <- hIsEOF hdl
   print flg
   hSeek hdl SeekFromEnd (-1)
   flg <- hIsEOF hdl
   print flg
   hGetChar hdl
   flg <- hIsEOF hdl
   print flg
   hSeek hdl SeekFromEnd (-1)
   flg <- hIsEOF hdl
   print flg
   hClose hdl