title: Clearing std :: string in while loop С++
body: <p>I am creating a Thread which contains a While loop. It gets data <br/> from the API site every iteration, checking the new data.</p>
  <pre><code>string data;
  while (true) {
       data = get_contents ('http://example.com/');
       Sleep (300,000);
  }
  </code></pre>
  <p>The problem is that the <code>string data</code> variable is not cleared. <br/>
  What i can you do with it?</p>
  <p>PS: I was try this, but this is not working.</p>
  <pre><code>data.erase();
  data.clear();
  data.resize(0);
  </code></pre>