diff --git a/UData.hs b/UData.hs index 983df31..6706bcc 100644 --- a/UData.hs +++ b/UData.hs @@ -45,7 +45,7 @@ applyBVal :: BValue -> BValue -> BResult applyBVal (BFuncVal b) (BNumVal v) = applyBFunc b v applyBVal (BFuncVal b) _ = BException ("cannot apply built-in function "++(showBFunc b)++" on non-numeric value") applyBVal (BIntList args) (BNumVal (BInt v)) = BClean (BIntList (v:args)) -applyBVal (BIntList args) _ = BException "cannot append non-integer number in IntList" +applyBVal (BIntList args) _ = BException "cannot append non-integer number to IntList" applyBVal _ _ = BException "cannot use numeric value as function" applyBFunc :: BFunc -> BNum -> BResult diff --git a/UEnvironment.hs b/UEnvironment.hs index 29b9a27..6edd8c2 100644 --- a/UEnvironment.hs +++ b/UEnvironment.hs @@ -86,7 +86,7 @@ instance UEnv URealWorldEnv where else if (any (not.isValidCharInt) filename) then return ((-3),initfiles) else - (openFile (map chr filename) (efOpenModes!!mode) >>= + (openBinaryFile (map chr filename) (efOpenModes!!mode) >>= (\handle -> ( let (fno,files1) = flAddHandle handle initfiles in return (fno,files1) ))) diff --git a/test.u b/test.u index c14bd15..aed3966 100644 --- a/test.u +++ b/test.u @@ -1,6 +1,12 @@ (import* str) (import* io) (run + (fin (open "2.bin" 0)) + (c (getCharF fin)) + (_ (putStrLn (itoa c))) + ;(fout (open "2.bin" 1)) + ;(_ (putCharF fout 255)) + ;(_ (close fout)) ;(line readLine) ;(_ (putStrLn line)) ;(r (system "ls -l"))