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

readCdRom fd byteCount = do
        (buf, actualByteCount) = fdRead fd bytecount
        readCdRom fd byteCount

When it executed it read thousands of 4096 blocks as I expected. It then got
a "hardware error" which I suspect was the "end of the CD", i.e. the
begininng of the "unlasered" part of the CD. Is there a better and more
graceful way to detect and handle "end of data"?

Thanks, ,Vasili
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to