Created
May 18, 2014 02:29
-
-
Save naoto-ogawa/400c9d2a32a4498bdd5d to your computer and use it in GitHub Desktop.
Read a bite from a binary file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.IO | |
import qualified Data.ByteString.Lazy as BL | |
import Data.Binary.Get | |
test_binary :: IO () | |
test_binary = do | |
rh <- openFile "test.ppm" ReadMode | |
i <- BL.hGetContents rh | |
let d = runGet (getWord8) i | |
putStr $ show d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment