title: How do I copy a character array to the clipboard?
body: <p>I am trying to get my application to copy a character array to the clipboard so it can be pasted into an IE address bar. I am having an issue with getting this working. This is the code I am working with:</p>
  
  <pre><code>HGLOBAL glob = GlobalAlloc(GMEM_FIXED,32);
  memcpy(glob,array,sizeof(array));
  OpenClipboard(hDlg);
  EmptyClipboard();
  SetClipboardData(CF_UNICODETEXT,glob);
  CloseClipboard();
  </code></pre>
  
  <p>Array is declared as:</p>
  
  <pre><code>char array[500];
  </code></pre>
  
  <p>This will cause the program to crash. However if I switch out <code>sizeof(array)</code> with a number it ok but The only 8 characters are copyied to the clipboard.</p>
  
  <p>Can anyone advise me on how to solve this issue? I am targeting the Win32 API directly, not using MFC.</p>