title: How to read data from a text file in C
body: <p>I have the following text file: </p>
  
  <pre><code>ax: 0
  ay: -9.8
  x: 0
  y: 50
  vx: 8.66
  vy: 6
  </code></pre>
  
  <p>I want to read only the numerical values to be used for computations. Is there a way to ignore the strings and just read the values as floats?</p>
  
  <p>Here is what I have so far: </p>
  
  <pre><code>FILE *fp; 
  FILE *fr;
  
  fr = fopen("input_data", "rt");
  fp = fopen("out_file.txt", "w");  
  
  if(fr == NULL) {
      printf("File not found");
  }
  
  if(fp == NULL) {
      printf("File not found");
  }    
  
  float ax = 0, ay = 0,
        x = 0, y = 0,
        vx = 0, vy = 0,
        time = 0, deltaTime = 0; 
  
  fscanf(fr, "%f %f %f %f %f %f %f %f\n",
         &amp;ax, &amp;ay, &amp;x, &amp;y, &amp;vx, &amp;vy, &amp;time, &amp;deltaTime);
  
  printf("%f %f %f %f %f %f %f %f\n",
         ax, ay, x, y, vx, vy, time, deltaTime); 
  </code></pre>