title: How to Read and Compare string in a file then get the number/s beside it in C
body: <p>This is the Algorithm:</p>
  
  <ol>
  <li>Open the file.</li>
  <li>Read a string from the file.</li>
  <li>Compare the string.
  <ul>
  <li>If the string matches, get the number/s after '=', then exit the loop.</li>
  </ul></li>
  <li>Check the end of the file.
  <ul>
  <li>If it's not yet the end of the file, go back to step 2. </li>
  <li>If the end of the file is met exit the loop, and go to step 5.</li>
  </ul></li>
  <li>The string is not in the file.</li>
  </ol>
  
  <p>This is the program i made:</p>
  
  <pre><code>FILE *fp = fopen("Converter.txt", "r");
  char a;
  
  while( fgets(line, sizeof(line), fp) != NULL ){
      if(strcmp(line,a)){
          printf("There is such string");
          sscanf(line,"%*[^=]=%f", &amp;num);
          printf("\n\n%.2f",num);
      }else{
          printf("NULL\n");
          continue;
      }break;
  }
  </code></pre>
  
  <p>inside of file:</p>
  
  <pre><code>Inch to Meter = 0.0254
  Foot to Centimeter = 30.84
  Foot to Inch = 12.00
  and many more.
  </code></pre>
  
  <p>Input: </p>
  
  <pre><code>Foot to Centimeter
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>There is such string
  
  30.84
  </code></pre>
  
  <p>The problem is it only scan the first line and it doesn't scan the number beside the string that it compares. </p>
  
  <p>Thanks.</p>