summaryrefslogtreecommitdiff
path: root/libraries/base/tests/IO/readwrite003.hs
blob: c8995e3e7d66de8d9cfae96d725c4c9608f12e14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import System.IO

file = "readwrite003.txt"

main = do
  writeFile file "ab\ncd\nef\ngh"
  h <- openFile file ReadWriteMode
  hGetLine h
  hPutStrLn h "yz"
  hClose h
  h <- openBinaryFile file ReadMode
  hSetNewlineMode stdout noNewlineTranslation
  hGetContents h >>= putStr