Thanks a lot guys. "Show" seems to have solved the problem. The only weird thing is that created file is not exactly the same size (100 bytes bigger) but hopefully that should not be a problem. Just would like to point that openFile function from IO library did not write the right string representation (Just small part of it) while openFileEx in IOExts library did write the whole thing. Maybe it is a bug? As a last question I am curious about a thing you guys typed a lot latelly, What does the $ sign (Dollar) does?? Thanks again Alex ----- Original Message ----- From: "Glynn Clements" <glynn.clements@virgin.net> To: "Alexandre Weffort Thenorio" <alethenorio@home.se> Cc: "Keith Wansbrough" <Keith.Wansbrough@cl.cam.ac.uk>; <haskell@haskell.org> Sent: Wednesday, April 30, 2003 6:16 AM Subject: Re: Is it possible to build in a file in a haskell program?? Alexandre Weffort Thenorio wrote:
OK. Here is what happen. I wrote the small haskell program that write another haskell program containing a string representation of the bin file.
If use openFile function the string representation is not complete (Doesn't write the whole bin file, bug maybe) but if I use openFileEx (IOExts Library, Lang Package) it writes the whole thing
BUT both ways it still gives me a file with a binary string representation (Weird sings) like:
module MyBinFile ( mybinfile ) where mybinfile :: String mybinfile = "Ì þs$>Ì Ì þVÌ 01o ¦·?sfÌ{%z-æÇdæÇe_ Æe\\\\ÃàQ'%Ñàz&òÆdÑày&çÖà{ÇdÖà|Çez-ÆdçÆeç? 00 0...."
thus of course giving me a error in character literal in third line when trying to run the old main (That is gonna rewrite the bin file). Any ideas??
Use "show", e.g. hPutStrLn outFile $ "mybinfile = " ++ show theString -- Glynn Clements <glynn.clements@virgin.net>