Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Easiest way to turn numbers into a string is to use <a href="http://www.cplusplus.com/reference/iostream/ostringstream/" rel="nofollow"><code>ostringstream</code></a></p> <pre><code>#include &lt;sstream&gt; #include &lt;string&gt; std::ostringstream os; os &lt;&lt; x &lt;&lt; y &lt;&lt; z; std::string str = os.str(); // 6490240 </code></pre> <p>You can even make use of manipulators to do this in hex or octal:</p> <pre><code>os &lt;&lt; std::hex &lt;&lt; x &lt;&lt; y &lt;&lt; z; </code></pre> <p><strong>Update</strong></p> <p>Since you've clarified what you really want to do, I've updated my answer. You're looking to take RGB values as three bytes, and use them as a key somehow. This would be best done with a long int, not as a string. You can still stringify the int quite easily, for printing to the screen.</p> <pre><code>unsigned long rgb = 0; byte* b = reinterpret_cast&lt;byte*&gt;(&amp;rgb); b[0] = x; b[1] = y; b[2] = z; // rgb is now the bytes { 0, x, y, z } </code></pre> <p>Then you can use the <code>long int rgb</code> as your key, very efficiently. Whenever you want to print it out, you can still do that:</p> <pre><code>std::cout &lt;&lt; std::hex &lt;&lt; rgb; </code></pre> <p>Depending on the endian-ness of your system, you may need to play around with which bytes of the long int you set. My example overwrites bytes 0-2, but you might want to write bytes 1-3. And you might want to write the order as z, y, x instead of x, y, z. That kind of detail is platform dependent. Although if you never want to print the RGB value, but simply want to consider it as a hash, then you don't need to worry about which bytes you write or in what order.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload