Problems with 'readFile'

Ketil Z. Malde ketil@ii.uib.no
23 May 2003 13:17:01 +0200


Niels Reyngoud <nreijngo@cs.uu.nl> writes:

> During work on the project, we encountered a problem with the
> 'readFile' IO Monad.  readFile stops reading a file when it
> encounters ASCII character 26, as the following piece of coding
> shows.

Hmm...let me try:

    % ghci
      ___         ___ _
     / _ \ /\  /\/ __(_)
    / /_\// /_/ / /  | |      GHC Inter[..], v[..] 5.04.2, for H[..] 98.
   / /_\\/ __  / /___| |      http://www.haskell.org/ghc/
   \____/\/ /_/\____/|_|      Type :? for help.

      [...]

    Prelude> writeFile "test.txt" ("1234567890"++ Char.chr 26 : "abcdefgh")
    Prelude> readFile "test.txt"
    Prelude> it
    "1234567890\SUBabcdefgh"
    Prelude> map Char.ord it
    [49,50,51,52,53,54,55,56,57,48,26,97,98,99,100,101,102,103,104]

Seems to work fine for me.  What GHC version/OS/architecture are you
using? 

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants