title: Prepend hex string to the content of binary file
body: <p>I have these 2 arrays representing hexadecimal numbers and I want to write to a file in binary format.</p>
  
  <p>I convert to hexadecimal string like this:</p>
  
  <pre><code>a=["A2","48","04","03","EE","72","B4","6B"]
  b=["1A","28","18","06","07","00","11","86","05","01","01","01","A0"]
  
  hex_string1 = a.map{|b| b.to_i(16)}.pack("C*")
  hex_string2 = b.map{|b| b.to_i(16)}.pack("C*")
  </code></pre>
  
  <p>Now I want to write to a file the <code>hex_string2</code> first and then prepend (with offset "0") the <code>hex_string1</code> to the file.</p>
  
  <p>I'm proceeding like this but the output is incorrect.</p>
  
  <pre><code>File.binwrite("outfile.bin",hex_string2)
  File.binwrite("outfile.bin",hex_string1,0)
  </code></pre>
  
  <p>The current output is:</p>
  
  <pre><code>A2 48 04 03 EE 72 B4 6B 05 01 01 01 A0
  </code></pre>
  
  <p>And the correct content within the "output.bin" would be like this:</p>
  
  <pre><code>A2 48 04 03 EE 72 B4 6B 1A 28 18 06 07 00 11 86 05 01 01 01 A0
  </code></pre>
  
  <p>How would be the way to do this?</p>