hPutBuf

hPutBuf hdl buf count writes count 8-bit bytes from the buffer buf to the handle hdl. It returns (). hPutBuf ignores any text encoding that applies to the Handle, writing the bytes directly to the underlying file or device. hPutBuf ignores the prevailing TextEncoding and NewlineMode on the Handle, and writes bytes directly. This operation may fail with:
  • ResourceVanished if the handle is a pipe or socket, and the reading end is closed. (If this is a POSIX system, and the program has not asked to ignore SIGPIPE, then a SIGPIPE may be delivered instead, whose default action is to terminate the program).
As a wrapper around the standard function hPutBuf, this function takes a standard Haskell String instead of the far less convenient Ptr a. The entire contents of the string will be written as a binary buffer using hPutBuf. The length of the output will be the length of the passed String or list. If it helps, you can thing of this function as being of type Handle -> String -> IO ()
Write the contents of a buffer to a handle open for writing. Return the number of frames written.