title: how to scan a text file with fscanf using delimiters?
body: <p>So this is how the text in the file looks like:</p>
  
  <pre><code>    locked y
      locked n
      position 90
      position 2
      audio-language "english"
      audio-language "spanish"
  </code></pre>
  
  <p>each text file contains only one kind of the settings shown above, the difference is the option (y or n, 1 to 999, "english" "spanish" "whatever else") it has 4 white spaces in front and a new line at the end of each line, so I need a fscanf that will extract the parameter in a char array string, but I cant seem to understand how to use the delimiters right. I have to make a program that can scan that file and print the different settings and how many times they are found in the file for example:</p>
  
  <pre><code>audio-language is found with setting: "spanish" 40 times
  
  audio-language is found with setting: "english" 78 times
  </code></pre>
  
  <p><em><strong>Than you all for your answers! Here i can show you how I made it work:</em></strong></p>
  
  <p>1 - First you use a funcion ( that I found on the internet ) that eliminates the white spaces in front of the settings:</p>
  
  <pre><code>char* ltrim(char* s) 
  {
      char* newstart = s;
  
    while (isspace( *newstart)) {
      ++newstart;
     }
  
     // newstart points to first non-whitespace char (which might be '\0')
     memmove( s, newstart, strlen( newstart) + 1); // don't forget to move the '\0' terminator
  
  return s;
   }
  </code></pre>
  
  <p>2 - Then fscanf has no problem getting the line right:</p>
  
  <pre><code>while(!feof(fpoo)) {
      fscanf(fpoo,"%s %[^\n]",&amp;first, &amp;sec);
  </code></pre>
  
  <p>3 - Then you compare the ones fscanf got with the ones the user entered</p>
  
  <p>That's it, apparently the whole problem with <strong>fscanf</strong> was because of the white spaces in front of every line.</p>