1 -- !!! Testing hGetPosn and hSetPosn
2 module Main(main) where
10 putStrLn ("At position: " ++ show x ++ ", found: " ++ show v)
13 recordDoAndRepos h a = do
14 x <- getPosnAndPrint h
16 hSeek h AbsoluteSeek x
20 recordDoAndRepos2 h a = do
21 x <- getPosnAndPrint h
23 hSeek h AbsoluteSeek x
27 recordDoAndRepos3 h a = do
28 x <- getPosnAndPrint h
30 hSeek h SeekFromEnd (negate (x + 1))
38 h <- openFile file ReadMode
47 h <- openFileEx file (BinaryMode ReadMode)
55 putStrLn "\nUsing hSeek/AbsoluteSeek: "
56 h <- openFile file ReadMode
65 putStrLn "\nUsing hSeek/SeekFromEnd: "
66 putStrLn "(Don't worry if you're seeing differing numbers here, it might be down to '\\n' vs '\\r\\n')"
67 h <- openFile file ReadMode