summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/IO/readwrite001.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/IO/readwrite001.hs')
-rw-r--r--testsuite/tests/lib/IO/readwrite001.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/lib/IO/readwrite001.hs b/testsuite/tests/lib/IO/readwrite001.hs
new file mode 100644
index 0000000000..4a94ef10eb
--- /dev/null
+++ b/testsuite/tests/lib/IO/readwrite001.hs
@@ -0,0 +1,23 @@
+-- !!! RW files
+
+module Main(main) where
+
+import System.IO
+import System.Directory ( removeFile, doesFileExist )
+import Control.Monad
+
+main = do
+ f <- doesFileExist "readwrite001.inout"
+ when f (removeFile "readwrite001.inout")
+ hdl <- openFile "readwrite001.inout" ReadWriteMode
+ hSetBuffering hdl LineBuffering
+ hPutStr hdl "as"
+ hSeek hdl AbsoluteSeek 0
+ ch <- hGetChar hdl
+ print ch
+ hPutStr hdl "ase"
+ hSeek hdl AbsoluteSeek 0
+ putChar '\n'
+ ls <- hGetContents hdl
+ putStrLn ls
+