title: setting the internal buffer for std::istringstream
body: <p>I have the following piece of code that used to work in OS X before I upgraded to OS X 10.9.4
  This is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;sstream&gt;
  
  int main() {
      // Buffer to be read
      const char* buffer = "0 3";
      std::cout &lt;&lt; "buffer: '" &lt;&lt; buffer &lt;&lt; "'\n";
      size_t len = 3;
  
      std::istringstream iss;
      iss.clear();
      iss.rdbuf()-&gt;pubsetbuf((char*)buffer, len);
  
      // Did iss got a hold of buffer?
      std::cout &lt;&lt; "str: '" &lt;&lt; iss.str() &lt;&lt; "'\n";
  }
  </code></pre>
  
  <p>The idea is simple, and it has been already <a href="https://stackoverflow.com/q/16875321/788553">asked</a>. I want to be able to read from an existing string and read from it without having to copy its contents. As I already mentioned, this code does not give the correct output in OS X 10.9.4. </p>
  
  <p>My guess as to why this is the case, is because as it was mentioned in this <a href="https://stackoverflow.com/q/1494182/788553">post</a> the implementation of <code>pubsetbuf</code> does nothing.</p>
  
  <p>My question is: Is there a way of achieving the desired results in every machine? What would I need to do in order to set the internal buffer correctly?</p>
  
  <p>In case this is not clear, I expect the following output:</p>
  
  <pre><code>buffer: '0 3'
  str: '0 3'
  </code></pre>
  
  <p>The current output I'm obtaining in my machine is</p>
  
  <pre><code>buffer: '0 3'
  str: ''
  </code></pre>
  
  <p>Meaning that the internal buffer in the <code>istringstream</code> was not set.</p>