title: How to convert unsigned int (pointer) to const char in C++
body: <p>How do I convert an unsigned int (UINT32) to a const char.</p>
  
  <p>I tried to cast it but because isn’t type safe is crashing when the pointer is bigger than expected.</p>
  
  <p>So how can I approach this correctly?</p>
  
  <pre><code>    unsigned int p = 0x32422342;
      strLocation = QString::fromUtf8((char*)p, sizeof(p));
  </code></pre>
  
  <p>BTW if I leave the cast, the compiler is showing up an exception:</p>
  
  <pre><code>cast to `const char*`from smaller integer type `UINT32` (aka `unsigned int`) [-Wint-to-pointer-cast]
  </code></pre>
  
  <p>any suggestions? The value is just a random number, just for clarification.</p>