title: Converting a string to float using std::istringsteam in C++
body: <p>I've been trying to convert a simple string to a float, but I'm having no luck with it. this is what I've got at the moment:</p>
  
  <pre><code>int main()
  {
      float value;
      std::string stringNum = "0.5";
      std::istringstream(stringNum) &gt;&gt; value;
  
      return 0
  }
  </code></pre>
  
  <p>but I'm getting this error: </p>
  
  <pre><code>Error   2   error C2440: '&lt;function-style-cast&gt;' : cannot convert from 'std::string' to 'std::istringstream'    c:\users\administrator\desktop\Test\main.cpp    12
  </code></pre>
  
  <p>can anyone give me some guidance here on how to just simply convert the string to a float?</p>
  
  <p>Thanks</p>