Re: [Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Adam Langley
2008/2/1 Galchin Vasili [EMAIL PROTECTED]: I wrote a simple program to read the contents of a cdrom: (Note that this is a terribly inefficient way of reading large amounts of binary data. Of course, if this is just meant as an example, that's fine. Otherwise, see the struff about

[Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Galchin Vasili
Hello, I wrote a simple program to read the contents of a cdrom: module Main where import Text.Printf import System.IO import System.Posix.Types import System.Posix.IO main = do fd - openFd /dev/cdrom ReadOnly Nothing defaultFileFlags readCdRom fd 4096 closeFd fd

Re: [Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Galchin Vasili
Thank you Adam and Bradley. My program is my getting a feel of how to open a Linux and do block reads. Just conceptual Vasili On 2/1/08, Adam Langley [EMAIL PROTECTED] wrote: On Feb 1, 2008 1:42 PM, Bryan O'Sullivan [EMAIL PROTECTED] wrote: No, it's the Haskell runtime turning a -1 return

Re: [Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Bryan O'Sullivan
Adam Langley wrote: The error you are seeing comes from the operating system. No, it's the Haskell runtime turning a -1 return from read into an exception. You need to call hIsEOF to check whether you've hit EOF, then break out of the loop. b

Re: [Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Adam Langley
On Feb 1, 2008 1:42 PM, Bryan O'Sullivan [EMAIL PROTECTED] wrote: No, it's the Haskell runtime turning a -1 return from read into an exception. You need to call hIsEOF to check whether you've hit EOF, then break out of the loop. (assuming you meant 0, not -1) My bad, I thought that the