Typo
[packages/base.git] / tests / IO / misc001.hs
1 import System.IO
2
3 import Data.Char (toUpper)
4 import System.Directory (removeFile, doesFileExist)
5 import System.Environment (getArgs)
6
7 main = do
8 [f1,f2] <- getArgs
9 h1 <- openFile f1 ReadMode
10 f <- doesFileExist f2
11 if f then removeFile f2 else return ()
12 h2 <- openFile f2 WriteMode
13 copyFile h1 h2
14 hClose h1
15 hClose h2
16
17 copyFile h1 h2 = do
18 eof <- hIsEOF h1
19 if eof
20 then return ()
21 else do
22 c <- hGetChar h1
23 c <- hPutChar h2 (toUpper c)
24 copyFile h1 h2