title: Reading data from file and filling in STL vector
body: <pre><code>struct DataValue
  {
      DataValue() : uiQuality(0) {} // Here 0 stands for good.
      unsigned int    uiQuality;
      std::string     timeChanged;
      float           value;
  };
  
  std::vector&lt;DataValues&gt; myDataValues
  </code></pre>
  
  <p>At some point in my application data in my vector is filled. I am writing to a file using below.</p>
  
  <pre><code>std::ofstream myfile("myData.txt", std::ios::app);
  
  for (int j = 0; j &lt; myDataValues.size(); j++)
  {
      std::string quality;
      if(myDataValues[j].quality == 0) {
          quality = "good";
      }
      else {
          quality = "bad";
      }
      myfile &lt;&lt; myDataValues[j].timeChanged.c_str() &lt;&lt; "  " &lt;&lt;  myDataValues[j].value  &lt;&lt; "  " &lt;&lt;  quality &lt;&lt; std::endl; 
  }
  </code></pre>
  
  <p>File looks like below.</p>
  
  <pre><code>2012-06-25 12:41:56.789  55  good
  2012-06-25 12:51:14.782  55  good
  2012-06-25 05:25:16.456  62.6925  good
  2012-06-25 05:26:11.458  63.4109  good
  2012-06-25 05:27:01.459  63.0383  good
  2012-06-25 05:27:56.959  61.5266  good
  2012-06-25 05:29:01.959  58.5354  good
  2012-06-25 05:32:06.963  47.5656  good
  2012-06-25 05:33:06.964  44.9916  good
  2012-06-25 05:33:11.963  44.8267  good
  2012-06-25 05:34:06.965  43.6011  good
  2012-06-25 05:34:56.965  43.493  good
  2012-06-25 12:51:14.782  52.418  good
  2012-06-25 09:49:54.112  0  good
  2012-06-25 11:50:30.781  0  good
  </code></pre>
  
  <p>Now I have to read above file in other application and fill another vector for example. Fill vector wheter it is duplicate or not this check is not required.</p>
  
  <pre><code> std::vector&lt;DataValues&gt; anotherDataValues
  </code></pre>
  
  <p>Request sample code How do I read data from above file and fill above vector?</p>
  
  <p>How do I do this effectively.</p>
  
  <p>Thanks for your time and help.</p>