title: msgpack C++ implementation: How to pack binary data?
body: <p>I am making use of C++ msgpack implementation. I have hit a roadblock as to how to pack binary data. In terms of binary data I have a buffer of the following type:</p>
  
  <pre><code>unsigned char* data;
  </code></pre>
  
  <p>The <strong>data</strong> variable points to an array which is actually an image. What I want to do is pack this using msgpack. There seems to be no example of how to actually pack binary data. From the <a href="http://wiki.msgpack.org/display/MSGPACK/Format+specification">format specification</a> raw bytes are supported, but I am not sure how to make use of the functionality.</p>
  
  <p>I tried using a vector of character pointers like the following:</p>
  
  <pre><code>msgpack::sbuffer temp_sbuffer;
  std::vector&lt;char*&gt; vec;
  msgpack::pack(temp_sbuffer, vec);
  </code></pre>
  
  <p>But this results in a compiler error since there is no function template for <strong>T=std::vector</strong>.</p>
  
  <p>I have also simply tried the following:</p>
  
  <pre><code>msgpack::pack(temp_sbuffer, "Hello");
  </code></pre>
  
  <p>But this also results in a compilation error (i.e. no function template for <strong>T=const char [6]</strong></p>
  
  <p>Thus, I was hoping someone could give me advice on how to use msgpack C++ to pack binary data represented as a <strong>char</strong> array.</p>