26 May
                
                    2007
                
            
            
                26 May
                
                '07
                
            
            
            
        
    
                8:44 p.m.
            
        Leandro Lisboa Penz:
I'm having some problems using ByteString.Char8.readFile to read "/proc/interrupts". I reads nothing. I guess maybe that's because the file is sort of special, but I could read it by opening and using ByteString.Char8.hGetContents.
ByteString.Char8.readFile uses hFileSize to determine the buffer size to use:
readFile f = bracket (openFile f ReadMode) hClose (\h -> hFileSize h >>= hGet h . fromIntegral)
Now, if you look at the size of /proc/interrupts, as reported by ls, you should see the problem. By contrast, ByteString.Char8.hGetContents determines the required buffer size by reading to the end of the file.