
If I open a file using "openFile" from the IO module (x <- openFile "foo.txt" ReadMode) and convert it to a String via hGetContents (y <- hGetContents x) and finally try to print the file on the screen (putStrLn y) I'll get a strange result if the file contains the character 1A-hexadecimal (or 26-decimal): all characters beyond this point won't be printed on the screen. If I use openFileEx (from IOExts module) rather than openFile, some characters will be printed after the 1A/26, but not all of them. I know this special character is related to EOF or something like that in Windows platforms, but is this the expected behavior of function hGetContents? (please reply to both the list AND me) Thanks, -- Andre Furtado

I'll get a strange result if the file contains the character 1A-hexadecimal (or 26-decimal): all characters beyond this point won't be printed on the screen.
I think this is correct behaviour for a text file under Windows/DOS... you should open the file as binary instead. --KW 8-)

I'll get a strange result if the file contains the character 1A-hexadecimal (or 26-decimal): all characters beyond this point won't be printed on the screen.
I think this is correct behaviour for a text file under Windows/DOS... you should open the file as binary instead.
When I said I tryied to use OpenFileEx, I also was trying to say that I used the option BinaryMode. In a Windows2k platform, the program works well, but in Windows98 I got the problem I said before. I think the program READS the file correctly, but DISPLAYS it on the screen in a wrong way. Am I right about this? -- Andre
participants (2)
-
Andre W B Furtado
-
Keith Wansbrough