Skip to content
Snippets Groups Projects
Commit 3b8b96b3 authored by sof's avatar sof
Browse files

[project @ 1999-11-02 11:25:42 by sof]

updated with expected-output files
parent 727f51dc
No related merge requests found
......@@ -64,6 +64,7 @@ main = do
hClose h
putStrLn "\nUsing hSeek/SeekFromEnd: "
putStrLn "(Don't worry if you're seeing differing numbers here, it might be down to '\\n' vs '\\r\\n')"
h <- openFile "io001.hs" ReadMode
recordDoAndRepos3 h $
recordDoAndRepos3 h $
......
At position: 0, found: '-'
At position: 1, found: '-'
At position: 2, found: ' '
At position: 3, found: '!'
At position: 4, found: '!'
At position: 4, found: '!'
At position: 3, found: '!'
At position: 2, found: ' '
At position: 1, found: '-'
At position: 0, found: '-'
At position: 0, found: '-'
At position: 1, found: '-'
At position: 2, found: ' '
At position: 3, found: '!'
At position: 4, found: '!'
At position: 4, found: '!'
At position: 3, found: '!'
At position: 2, found: ' '
At position: 1, found: '-'
At position: 0, found: '-'
Using hSeek/AbsoluteSeek:
At position: 0, found: '-'
At position: 1, found: '-'
At position: 2, found: ' '
At position: 3, found: '!'
At position: 4, found: '!'
At position: 4, found: '!'
At position: 3, found: '!'
At position: 2, found: ' '
At position: 1, found: '-'
At position: 0, found: '-'
Using hSeek/SeekFromEnd:
(Don't worry if you're seeing differing numbers here, it might be down to '\n' vs '\r\n')
At position: 0, found: '-'
At position: 1, found: '-'
At position: 2, found: ' '
At position: 3, found: '!'
At position: 4, found: '!'
At position: 1740, found: ' '
At position: 1741, found: '"'
At position: 1742, found: '"'
At position: 1743, found: '\n'
At position: 1743, found: '\n'
......@@ -8,17 +8,18 @@ import Directory
main :: IO ()
main = do
h <- openFile "tst-seek" WriteMode
hPutStrLn h "test string1"
hPutStr h "test string1"
-- seek to EOF should be cool..
hSeek h SeekFromEnd 0
hPutStr h "test string2"
-- seek past EOF should now be cool..
-- seek past EOF should now also be cool..
hSeek h SeekFromEnd 3
hPutStr h "test string3"
hSeek h AbsoluteSeek 13
hPutStr h "test string4"
x <- hTell h
print x
hPutStr h "filler"
hClose h
ls <- readFile "tst-seek"
putStrLn ls
......
25
test string1ttest string4filler string3
......@@ -7,6 +7,6 @@ import IOExts
loop r 0 = return ()
loop r c = loop r (c-1) >> writeIORef r 42
main = newIORef 0 >>= \r -> loop r 1000000
main = newIORef 0 >>= \r -> loop r 1000000 >> putStrLn "done"
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment