title: Reading and storing values from .OBJ files using C++
body: <p>First, sorry for bad english. Well, I'm trying read the values of a .OBJ file (see <a href="https://mega.co.nz/#!AYVSTSyD!GI40jRZj4OMoLH4GDyyLWQvpVCV5t0HmKLjWtztLJdc" rel="nofollow">here</a>) and storing them in variables using this program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include &lt;sstream&gt;
  using namespace std;
  
  int main()
  {
  string line;
  string v, valuesX[8], valuesY[8], valuesZ[8];
  int n = 0;
  
  ifstream myfile ("cubo.obj");
  while(!myfile.eof())
  {
      getline (myfile,line);
      if (line[0] == 'v')
      {
          myfile &gt;&gt; v &gt;&gt; valuesX[n]&gt;&gt; valuesY[n]&gt;&gt; valuesZ[n];
          cout &lt;&lt; valuesX[n] &lt;&lt; "\t" &lt;&lt; valuesY[n] &lt;&lt; "\t" &lt;&lt; valuesZ[n] &lt;&lt; endl;
          n++;
      }
  }
  return 0;
  }
  </code></pre>
  
  <p>The file it's only a simple cube, exported by Blender. I expected him to show me all lines beginning with "v", but the result presents only the odd "v" lines. When I read directly the value of the variable "line", the result is the same. However, when I remove the line that assigns values ​​to variables "value" and read the variable "line" directly, the program works perfectly. Anyone know explain to me what is happening? Why the program is ignoring the even lines?</p>