title: Fivefold output from istringstream
body: <p>I would like to outout each line after a certain substring is detected. Somehow I get a fivefold output for <code>iss</code>. Here's my code: </p>
  
  <pre><code>    //load all data from txt
          string data;
          std::ifstream infile("SavedData.txt");
          while (std::getline(infile, data)) {
              std::istringstream iss(data);
              string d;
              while (iss &gt;&gt; d) {
                  //extract substring
                  unsigned firstBracket = data.find("(");
                  unsigned lastBracket = data.find(")");
                  string coordSynth = data.substr(firstBracket + 1, lastBracket - firstBracket - 1);
                  cout &lt;&lt; coordSynth &lt;&lt; endl;
              }
          }
  </code></pre>
  
  <p>The output right now is like: </p>
  
  <pre><code>0.0, 45.0, -390.0
  0.0, 45.0, -390.0
  0.0, 45.0, -390.0
  0.0, 45.0, -390.0
  0.0, 45.0, -390.0
  0.0, 45.0, -314.3
  0.0, 45.0, -314.3
  0.0, 45.0, -314.3
  0.0, 45.0, -314.3
  0.0, 45.0, -314.3
  etc.
  </code></pre>
  
  <p>Actually I just want </p>
  
  <pre><code>0.0, 45.0, -390.0
  0.0, 45.0, -314.3
  0.0, 45.0, -277.3
  etc.
  </code></pre>
  
  <p>And no, in the txt file there aren't duplcates. This file looks like this: </p>
  
  <pre><code>0001(0.0, 45.0, -390.0).png 
  0003(0.0, 45.0, -314.3).png 
  0007(0.0, 45.0, -277.3).png (and so on...)
  </code></pre>