<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi there,</p>
    <p>I want to write a function as a plugin to convert a 4 byte hex
      string like "405f612f" to float/double (3.49031 in this case).<br>
    </p>
    <p>An easy way to do so in C++ is this:<span
        class="code-preprocessor">
      </span></p>
    <pre id="pre205399" style="margin-top: 0px;" class="notranslate" lang="C++"><span class="code-keyword">#include</span><span class="code-preprocessor"> <span class="code-keyword">&lt;</span><span class="code-leadattribute">sstream</span><span class="code-keyword">&gt;</span>
</span></pre>
    <pre id="pre205399" style="margin-top: 0px;" class="notranslate" lang="C++"><span class="code-keyword">union</span> ulf
{
    <span class="code-keyword">unsigned</span> <span class="code-keyword">long</span> ul;
    <span class="code-keyword">float</span> f;
};

<span class="code-keyword">int</span> main()
{
    ulf u;
    string str = <span class="code-string">"</span><span class="code-string">405f612f"</span>;
    stringstream ss(str);
    ss &gt;&gt; hex &gt;&gt; u.ul;
    <span class="code-keyword">float</span> f = u.f;
    cout &lt;&lt; f &lt;&lt; endl;
}</pre>
    <p>Unfortunatly, to use "stringstream" I will have to include the
      &lt;sstream&gt; header file. Is this possible to do in plugin
      functions?<br>
    </p>
    <p>Thanks.</p>
    <p>Dane<br>
    </p>
  </body>
</html>