blob: b5950623eaca785aa288fffce1d2bf096f37a8d7 (
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 hGetLine
import System.IO
-- one version of 'cat'
main = do
let loop h = do b <- hIsEOF h
if b then return ()
else do l <- hGetLine h; putStrLn l; loop h
loop stdin
h <- openFile "hGetLine001.hs" ReadMode
hSetBinaryMode stdout True
hSetBuffering h NoBuffering
loop h
hSeek h AbsoluteSeek 0
hSetBuffering h LineBuffering
loop h
hSeek h AbsoluteSeek 0
hSetBuffering h (BlockBuffering (Just 83))
loop h
|