<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >System.IO.Binary</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_System-IO-Binary.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >MissingH-1.1.0.3: Large utility library</TD ><TD CLASS="topbut" ><A HREF="src/System-IO-Binary.html" >Source code</A ></TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >System.IO.Binary</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >portable to platforms supporting binary I\/O</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >provisional</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >John Goerzen <jgoerzen@complete.org></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >Support for different types of blocks </A ></DT ><DT ><A HREF="#2" >Entire File/Handle Utilities </A ></DT ><DD ><DL ><DT ><A HREF="#3" >Opened Handle Data Copying </A ></DT ><DT ><A HREF="#4" >Disk File Data Copying </A ></DT ></DL ></DD ><DT ><A HREF="#5" >Binary Single-Block I/O </A ></DT ><DT ><A HREF="#6" >Binary Multi-Block I/O </A ></DT ><DT ><A HREF="#7" >Lazy Interaction </A ></DT ><DD ><DL ><DT ><A HREF="#8" >Binary Block-based </A ></DT ></DL ></DD ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" ><P >This module provides various helpful utilities for dealing with binary input and output. </P ><P >You can use this module to deal with binary blocks of data as either Strings or lists of Word8. The BinaryConvertible class provides this abstraction. </P ><P >Wherever you see HVIO, you can transparently substite a regular Handle. This module can work with any HVIO object, however. See <A HREF="System-IO-HVIO.html" >System.IO.HVIO</A > for more details. </P ><P >Versions of MissingH prior 0.11.6 lacked the <TT ><A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A ></TT > class and worked only with Strings and Handles. </P ><P >Important note: /binary functions are not supported in all Haskell implementations/. Do not import or use this module unless you know you are using an implementation that supports them. At this time, here is the support status: </P ><UL ><LI > GHC 6.2 and above: yes </LI ><LI > GHC 6.x, earlier versions: unknown </LI ><LI > GHC 5.x: no </LI ><LI > nhc98: no </LI ><LI > Hugs: partial (maybe complete; needs more testing) </LI ></UL ><P >Non-binary functions may be found in <A HREF="System-IO.html" >System.IO</A >. </P ><P >See also: <A HREF="System-IO-BlockIO.html" >System.IO.BlockIO</A > </P ><P >Written by John Goerzen, jgoerzen@complete.org </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >class</SPAN > (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > a, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShow" >Show</A > a) => <A HREF="#t%3ABinaryConvertible" >BinaryConvertible</A > a <SPAN CLASS="keyword" >where</SPAN ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="#v%3AtoBuf" >toBuf</A > :: [a] -> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Foreign-Ptr.html#t%3APtr" >Ptr</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Foreign-C-Types.html#t%3ACChar" >CChar</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > c) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > c</TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfromBuf" >fromBuf</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Foreign-Ptr.html#t%3APtr" >Ptr</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Foreign-C-Types.html#t%3ACChar" >CChar</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A >) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [a]</TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AhBlockCopy" >hBlockCopy</A > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > b) => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> a -> b -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AblockCopy" >blockCopy</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AcopyFileBlocksToFile" >copyFileBlocksToFile</A > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AhPutBufStr" >hPutBufStr</A > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b) => a -> [b] -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AputBufStr" >putBufStr</A > :: <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b => [b] -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AhGetBufStr" >hGetBufStr</A > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b) => a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgetBufStr" >getBufStr</A > :: <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AhFullGetBufStr" >hFullGetBufStr</A > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b) => a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfullGetBufStr" >fullGetBufStr</A > :: <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [b]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AhGetBlocks" >hGetBlocks</A > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b) => a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [[b]]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AgetBlocks" >getBlocks</A > :: <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [[b]]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AhFullGetBlocks" >hFullGetBlocks</A > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b) => a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [[b]]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfullGetBlocks" >fullGetBlocks</A > :: <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [[b]]</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AreadBinaryFile" >readBinaryFile</A > :: <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AwriteBinaryFile" >writeBinaryFile</A > :: <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AhBlockInteract" >hBlockInteract</A > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > d, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > c) => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> a -> d -> ([[b]] -> [[c]]) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AblockInteract" >blockInteract</A > :: (<A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > c) => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> ([[b]] -> [[c]]) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AhFullBlockInteract" >hFullBlockInteract</A > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > d, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > c) => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> a -> d -> ([[b]] -> [[c]]) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfullBlockInteract" >fullBlockInteract</A > :: (<A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > c) => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> ([[b]] -> [[c]]) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >Support for different types of blocks </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><SPAN CLASS="keyword" >class</SPAN > (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Eq.html#t%3AEq" >Eq</A > a, <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Text-Show.html#t%3AShow" >Show</A > a) => <A NAME="t:BinaryConvertible" ><A NAME="t%3ABinaryConvertible" ></A ></A ><B >BinaryConvertible</B > a <SPAN CLASS="keyword" >where</SPAN ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#BinaryConvertible" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" ><P >Provides support for handling binary blocks with convenient types. </P ><P >This module provides implementations for Strings and for [Word8] (lists of Word8s). </P ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="section4" >Methods</TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:toBuf" ><A NAME="v%3AtoBuf" ></A ></A ><B >toBuf</B > :: [a] -> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Foreign-Ptr.html#t%3APtr" >Ptr</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Foreign-C-Types.html#t%3ACChar" >CChar</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > c) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > c</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#toBuf" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:fromBuf" ><A NAME="v%3AfromBuf" ></A ></A ><B >fromBuf</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> (<A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Foreign-Ptr.html#t%3APtr" >Ptr</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Foreign-C-Types.html#t%3ACChar" >CChar</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A >) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [a]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#fromBuf" >Source</A ></TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:BinaryConvertible')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:BinaryConvertible" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AChar" >Char</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Word.html#t%3AWord8" >Word8</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="2" ><A NAME="2" >Entire File/Handle Utilities </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="3" ><A NAME="3" >Opened Handle Data Copying </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:hBlockCopy" ><A NAME="v%3AhBlockCopy" ></A ></A ><B >hBlockCopy</B > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > b) => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> a -> b -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#hBlockCopy" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >Copies everything from the input handle to the output handle using binary blocks of the given size. This was once the following beautiful implementation: </P ><PRE > hBlockCopy bs hin hout = hBlockInteract bs hin hout id </PRE ><P >(<TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Prelude.html#v%3Aid" >id</A ></TT > is the built-in Haskell function that just returns whatever is given to it) </P ><P >In more recent versions of MissingH, it uses a more optimized routine that avoids ever having to convert the binary buffer at all. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:blockCopy" ><A NAME="v%3AblockCopy" ></A ></A ><B >blockCopy</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#blockCopy" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Copies from <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdin" >stdin</A ></TT > to <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdout" >stdout</A ></TT > using binary blocks of the given size. An alias for <TT ><A HREF="System-IO-Binary.html#v%3AhBlockCopy" >hBlockCopy</A ></TT > over <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdin" >stdin</A ></TT > and <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdout" >stdout</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="4" ><A NAME="4" >Disk File Data Copying </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:copyFileBlocksToFile" ><A NAME="v%3AcopyFileBlocksToFile" ></A ></A ><B >copyFileBlocksToFile</B > :: <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#copyFileBlocksToFile" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >Copies one filename to another in binary mode. </P ><P >Please note that the Unix permission bits on the output file cannot be set due to a limitation of the Haskell <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3AopenBinaryFile" >openBinaryFile</A ></TT > function. Therefore, you may need to adjust those bits after the copy yourself. </P ><P >This function is implemented using <TT ><A HREF="System-IO-Binary.html#v%3AhBlockCopy" >hBlockCopy</A ></TT > internally. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="5" ><A NAME="5" >Binary Single-Block I/O </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:hPutBufStr" ><A NAME="v%3AhPutBufStr" ></A ></A ><B >hPutBufStr</B > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b) => a -> [b] -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#hPutBufStr" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >As a wrapper around the standard function <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle.html#v%3AhPutBuf" >hPutBuf</A ></TT >, this function takes a standard Haskell <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TT > instead of the far less convenient <TT >Ptr a</TT >. The entire contents of the string will be written as a binary buffer using <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle.html#v%3AhPutBuf" >hPutBuf</A ></TT >. The length of the output will be the length of the passed String or list. </P ><P >If it helps, you can thing of this function as being of type <TT >Handle -> String -> IO ()</TT > </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:putBufStr" ><A NAME="v%3AputBufStr" ></A ></A ><B >putBufStr</B > :: <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b => [b] -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#putBufStr" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >An alias for <TT ><A HREF="System-IO-Binary.html#v%3AhPutBufStr" >hPutBufStr</A ></TT > <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdout" >stdout</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:hGetBufStr" ><A NAME="v%3AhGetBufStr" ></A ></A ><B >hGetBufStr</B > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b) => a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [b]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#hGetBufStr" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >Acts a wrapper around the standard function <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle.html#v%3AhGetBuf" >hGetBuf</A ></TT >, this function returns a standard Haskell String (or [Word8]) instead of modifying a 'Ptr a' buffer. The length is the maximum length to read and the semantice are the same as with <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle.html#v%3AhGetBuf" >hGetBuf</A ></TT >; namely, the empty string is returned with EOF is reached, and any given read may read fewer bytes than the given length. </P ><P >(Actually, it's a wrapper around <TT ><A HREF="System-IO-HVIO.html#v%3AvGetBuf" >vGetBuf</A ></TT >) </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:getBufStr" ><A NAME="v%3AgetBufStr" ></A ></A ><B >getBufStr</B > :: <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [b]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#getBufStr" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >An alias for <TT ><A HREF="System-IO-Binary.html#v%3AhGetBufStr" >hGetBufStr</A ></TT > <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdin" >stdin</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:hFullGetBufStr" ><A NAME="v%3AhFullGetBufStr" ></A ></A ><B >hFullGetBufStr</B > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b) => a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [b]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#hFullGetBufStr" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Like <TT ><A HREF="System-IO-Binary.html#v%3AhGetBufStr" >hGetBufStr</A ></TT >, but guarantees that it will only return fewer than the requested number of bytes when EOF is encountered. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:fullGetBufStr" ><A NAME="v%3AfullGetBufStr" ></A ></A ><B >fullGetBufStr</B > :: <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [b]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#fullGetBufStr" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >An alias for <TT ><A HREF="System-IO-Binary.html#v%3AhFullGetBufStr" >hFullGetBufStr</A ></TT > <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdin" >stdin</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="6" ><A NAME="6" >Binary Multi-Block I/O </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:hGetBlocks" ><A NAME="v%3AhGetBlocks" ></A ></A ><B >hGetBlocks</B > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b) => a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [[b]]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#hGetBlocks" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" ><P >An alias for <TT >hPutBlocks</TT > <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdout" >stdout</A ></TT > putBlocks :: (BinaryConvertible b) => [[b]] -> IO () putBlocks = hPutBlocks stdout </P ><P >Returns a lazily-evaluated list of all blocks in the input file, as read by <TT ><A HREF="System-IO-Binary.html#v%3AhGetBufStr" >hGetBufStr</A ></TT >. There will be no 0-length block in this list. The list simply ends at EOF. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:getBlocks" ><A NAME="v%3AgetBlocks" ></A ></A ><B >getBlocks</B > :: <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [[b]]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#getBlocks" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >An alias for <TT ><A HREF="System-IO-Binary.html#v%3AhGetBlocks" >hGetBlocks</A ></TT > <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdin" >stdin</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:hFullGetBlocks" ><A NAME="v%3AhFullGetBlocks" ></A ></A ><B >hFullGetBlocks</B > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b) => a -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [[b]]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#hFullGetBlocks" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Same as <TT ><A HREF="System-IO-Binary.html#v%3AhGetBlocks" >hGetBlocks</A ></TT >, but using <TT ><A HREF="System-IO-Binary.html#v%3AhFullGetBufStr" >hFullGetBufStr</A ></TT > underneath. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:fullGetBlocks" ><A NAME="v%3AfullGetBlocks" ></A ></A ><B >fullGetBlocks</B > :: <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > [[b]]</TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#fullGetBlocks" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >An alias for <TT ><A HREF="System-IO-Binary.html#v%3AhFullGetBlocks" >hFullGetBlocks</A ></TT > <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdin" >stdin</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="7" ><A NAME="7" >Lazy Interaction </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:readBinaryFile" ><A NAME="v%3AreadBinaryFile" ></A ></A ><B >readBinaryFile</B > :: <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#readBinaryFile" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Like the built-in <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#v%3AreadFile" >readFile</A ></TT >, but opens the file in binary instead of text mode. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:writeBinaryFile" ><A NAME="v%3AwriteBinaryFile" ></A ></A ><B >writeBinaryFile</B > :: <A HREF="System-IO-HVFS.html#t%3AFilePath" >FilePath</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Char.html#t%3AString" >String</A > -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#writeBinaryFile" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Like the built-in <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#v%3AwriteFile" >writeFile</A ></TT >, but opens the file in binary instead of text mode. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="8" ><A NAME="8" >Binary Block-based </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:hBlockInteract" ><A NAME="v%3AhBlockInteract" ></A ></A ><B >hBlockInteract</B > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > d, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > c) => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> a -> d -> ([[b]] -> [[c]]) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#hBlockInteract" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Binary block-based interaction. This is useful for scenarios that take binary blocks, manipulate them in some way, and then write them out. Take a look at <TT ><A HREF="System-IO-Binary.html#v%3AhBlockCopy" >hBlockCopy</A ></TT > for an example. The integer argument is the size of input binary blocks. This function uses <TT ><A HREF="System-IO-Binary.html#v%3AhGetBlocks" >hGetBlocks</A ></TT > internally. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:blockInteract" ><A NAME="v%3AblockInteract" ></A ></A ><B >blockInteract</B > :: (<A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > c) => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> ([[b]] -> [[c]]) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#blockInteract" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >An alias for <TT ><A HREF="System-IO-Binary.html#v%3AhBlockInteract" >hBlockInteract</A ></TT > over <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdin" >stdin</A ></TT > and <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdout" >stdout</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:hFullBlockInteract" ><A NAME="v%3AhFullBlockInteract" ></A ></A ><B >hFullBlockInteract</B > :: (<A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > a, <A HREF="System-IO-HVIO.html#t%3AHVIO" >HVIO</A > d, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > c) => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> a -> d -> ([[b]] -> [[c]]) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#hFullBlockInteract" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >Same as <TT ><A HREF="System-IO-Binary.html#v%3AhBlockInteract" >hBlockInteract</A ></TT >, but uses <TT ><A HREF="System-IO-Binary.html#v%3AhFullGetBlocks" >hFullGetBlocks</A ></TT > instead of <TT ><A HREF="System-IO-Binary.html#v%3AhGetBlocks" >hGetBlocks</A ></TT > internally. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="topdecl" ><TABLE CLASS="declbar" ><TR ><TD CLASS="declname" ><A NAME="v:fullBlockInteract" ><A NAME="v%3AfullBlockInteract" ></A ></A ><B >fullBlockInteract</B > :: (<A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > b, <A HREF="System-IO-Binary.html#t%3ABinaryConvertible" >BinaryConvertible</A > c) => <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/Data-Int.html#t%3AInt" >Int</A > -> ([[b]] -> [[c]]) -> <A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/System-IO.html#t%3AIO" >IO</A > <A HREF="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t%3A%28%29" >()</A ></TD ><TD CLASS="declbut" ><A HREF="src/System-IO-Binary.html#fullBlockInteract" >Source</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="doc" >An alias for <TT ><A HREF="System-IO-Binary.html#v%3AhFullBlockInteract" >hFullBlockInteract</A ></TT > over <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdin" >stdin</A ></TT > and <TT ><A HREF="/usr/share/doc/ghc/html/libraries/base-4.2.0.2/GHC-IO-Handle-FD.html#v%3Astdout" >stdout</A ></TT > </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.6.1</TD ></TR ></TABLE ></BODY ></HTML >