title: C++ equivalent for fscanf
body: <p>i would like to translate those code from c to c++</p>
  
  <pre><code> fscanf(file, "%f %f %f\n", &amp;v.x, &amp;v.y, &amp;v.z );
  </code></pre>
  
  <p>and </p>
  
  <pre><code>int matches = fscanf(file, "%d/%d/%d %d/%d/%d %d/%d/%d\n", &amp;vIndex[0], &amp;uvIndex[0], &amp;nIndex[0], &amp;vIndex[1], &amp;uvIndex[1], &amp;nIndex[1], &amp;vIndex[2], &amp;uvIndex[2], &amp;nIndex[2] );
  </code></pre>
  
  <p>i couldn't find any document about that on the internet. i suppose to use ifstream and stringstream but everything i read online is quite confusing.</p>
  
  <p>To make it worst, my ISP is having trouble which they blocked some site by accident (cplusplus.com ....) ==!! so i cannot really find anything useful currenly</p>
  
  <p>Can anyone help me con those code. Thank you guy a lot for this</p>
  
  <p>example of file</p>
  
  <blockquote>
    <p>v 1.000000 -1.000000 -1.000000  5 v 1.000000
    -1.000000 1.000000  6 v -1.000000 -1.000000 1.000000  7 v -1.000000 -1.000000 -1.000000  8 v 1.000000 1.000000 -1.000000  9 v 0.999999 1.000000 1.000001 10 v -1.000000 1.000000 1.000000 11 v -1.000000 1.000000 -1.000000 12 vt 0.748573 0.750412 13 vt 0.749279 0.501284 14 vt 0.999110 0.501077 15 vt 0.999455 0.750380 16 vt 0.250471 0.500702
    17 vt 0.249682 0.749677 18 vt 0.001085 0.750380 19 vt 0.001517
    0.499994 20 vt 0.499422 0.500239 21 vt 0.500149 0.750166 22 vt 0.748355 0.998230 23 vt 0.500193 0.998728 24 vt 0.498993 0.250415 25 vt 0.748953 0.250920 26 vn 0.000000 0.000000 -1.000000 27 vn -1.000000
    -0.000000 -0.000000 28 vn -0.000000 -0.000000 1.000000 29 vn -0.000001 0.000000 1.000000 30 vn 1.000000 -0.000000 0.000000 31 vn 1.000000 0.000000 0.000001 32 vn 0.000000 1.000000 -0.000000 33 vn -0.000000 -1.000000 0.000000 34 usemtl Material_ray.png 35 s off 36 f 5/1/1 1/2/1 4/3/1 37 f 5/1/1 4/3/1 8/4/1 38 f 3/5/2 7/6/2 8/7/2 39 f 3/5/2
    8/7/2 4/8/2 40 f 2/9/3 6/10/3 3/5/3 41 f 6/10/4 7/6/4 3/5/4 42 f 1/2/5
    5/1/5 2/9/5 43 f 5/1/6 6/10/6 2/9/6 44 f 5/1/7 8/11/7 6/10/7 45 f
    8/11/7 7/12/7 6/10/7 46 f 1/2/8 2/9/8 3/13/8 47 f 1/2/8 3/13/8 4/14/8</p>
  </blockquote>