Re: [Haskell-cafe] hFileSize vs length

2005-03-12 Thread Gracjan Polak

S. Alexander Jacobson wrote:
> I am using GHC 6.2 on windows and am finding that when I open a file and
> use hFileSize I get a different number than I get from reading in the
> file and calculating the length.  I assume this is not a bug, but I
> don't know why its happening.
Isn't that because of line end conversion? EOL on windows is \r\n (2 
bytes), when read converted on the fly to \n (1 char).

Try to open your file in binary mode.
>
> Also, why isn't there getFileSize function in System.Directory?
System.Posix.Files has getFileStatus and fileSize. No idea if they work 
on windows.

>
> -Alex-
>
> __
> S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] hFileSize vs length

2005-03-11 Thread S. Alexander Jacobson
I am using GHC 6.2 on windows and am finding that when I open a file 
and use hFileSize I get a different number than I get from reading in 
the file and calculating the length.  I assume this is not a bug, but 
I don't know why its happening.

Also, why isn't there getFileSize function in System.Directory?
-Alex-
__
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe