[Haskell-cafe] hSeek in Windows
ndmitchell at gmail.com
Sun Nov 1 15:48:34 EST 2009
The secret is there in the error message: "seek operations on
text-moddles are not allowed on this platform"
You need to set your file in to binary mode, with hSetBinaryMode
(http://haskell.org/hoogle/?hoogle=hSetBinaryMode) or openBinaryFile
(http://haskell.org/hoogle/?hoogle=openBinaryFile). After doing that
hSeek will work.
On Sun, Nov 1, 2009 at 8:44 PM, Philippos Apolinarius <phi500ac at yahoo.ca> wrote:
> As many people guess, I am trying to port programs from Clean 1.3 to Haskell (and also to Clean 2.2, which is easier, but not much easier). Late Professor Wellesley wrote an interesting data base manager in Clean 1.3 that I would like to see in Haskell and Clean 2.2. However, when I tried to implement the BTree algorithm, GHC compiler did not accept hSeek and other IO operations.
> D:\Programs\GHC-PROGS\docs\textut>ghc btree.hs --make
> [1 of 1] Compiling Main ( btree.hs, btree.o )
> Linking btree.exe ...
> btree.exe: teste.txt: hSeek: illegal operation (seek operations on text-mod
> dles are not allowed on this platform)
> To make a long story short, the program compiles, but does not run. This is interesting, because when Clean compiles an input/output operation it certainly executes it. In any case, what I should do in order to make file operations work on Windows? I need random access to text files.
> All new Yahoo! Mail - Get a sneak peak at messages with a handy reading pane.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe