
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

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
participants (2)
-
Gracjan Polak
-
S. Alexander Jacobson