Skip to content

Instantly share code, notes, and snippets.

@naoto-ogawa
Created May 18, 2014 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naoto-ogawa/400c9d2a32a4498bdd5d to your computer and use it in GitHub Desktop.
Save naoto-ogawa/400c9d2a32a4498bdd5d to your computer and use it in GitHub Desktop.
Read a bite from a binary file
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