title: Using strtok( ) to extract substring from double quotes
body: <p>I'm trying to make a code, that should read all of the columns, row by row in csv file; then storing them under a struct array, that is called movies in this code. I actually managed to store the data, but just because of picking the parameter of delimater in strtok lines, some of my movies' data has missing;
  Example: Row in the file:</p>
  <p>Synecdoche, New York - Charlie Kaufman - 2008 - Drama</p>
  <p>has to be stored as;</p>
  <p>id = 37</p>
  <p>name = Synecdoche, New York</p>
  <p>directorName = Charlie Kaufman</p>
  <p>year = 2008</p>
  <p>genre = Drama</p>
  <p>but it is stored as;</p>
  <p>id = 37</p>
  <p>name = Synecdoche</p>
  <p>directorName = New York</p>
  <p>year = Charlie Kaufman</p>
  <p>genre = 2008</p>
  <p>I am aware that this is because the string of characters I need to separate contains a comma; but I couldn't find how to solve it. So how can I make the strtok only split the string inside the double quotes?
  I don't know if anyone can understand; but still I leave my code like this below;</p>
  <pre><code>#include &lt;conio.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdbool.h&gt;
  
  typedef struct movie{
       int id;
       char name[100];
       char directorName[100];
       int year;
       char genre[30];
  } movie;
  
  movie movies[100];
  
  void remove_all_chars(char* str, char c) {
       char *pr = str, *pw = str;
       while (*pr) {
           *pw = *pr++;
           pw += (*pw != c);
       }
       *pw = '\0';
   }
  
  
  
  
   void fillMovies(FILE *filePointer)
   {
      char line[150];
      
      
      int id = 1;
      int arrIndex = 0;
      
      
      while(!feof(filePointer))
      {
          fgets(line, sizeof(line), filePointer);
          puts(line);
          //sleep(1);
      
          int i = 1;
          char* value = strtok(line, &quot;,&quot;);
      
          struct movie movie = {
              id,
              &quot;&quot;,
              &quot;&quot;,
              0,
              &quot;&quot;
          };
      
          while(value != NULL)
          {
              //remove_all_chars(value, '\&quot;');
              
              printf(&quot;%s &quot;, value);
              
              if(i == 1)
              {
                  //movie.name = value;
                  strcat(movie.name, value);
                  //movie.name += value;
                  i++;
                  value = strtok(NULL, &quot;,&quot;);
                  continue;
              }
              
              if(i == 2)
              {
                  //movie.directorName = value;
                  strcat(movie.directorName, value);
                  //movie.directorName += value;
                  i++;
                  value = strtok(NULL, &quot;,&quot;);
                  continue;
              }
              
              if(i == 3)
              {
                  movie.year = atoi(value);
                  i++;
                  value = strtok(NULL, &quot;,&quot;);
                  continue;
              }
              
              if(i == 4)
              {
                  //movie.genre = value;
                  strcat(movie.genre, value);
                  movies[arrIndex] = movie;
                  arrIndex++;
                  id++;
                  value = strtok(NULL, &quot;,&quot;);
                  break;
              }
          }
          printf(&quot;\n&quot;);
          
      }
      
      
  
      // Close the file
      fclose(filePointer);
      
   }
  
   void printMovie(int i)
   {
       sleep(1);
       printf(&quot;%d. &quot;, movies[i].id);
       printf(&quot;%s&quot;, movies[i].name);
       printf(&quot;, &quot;);
       printf(&quot;%s&quot;, movies[i].directorName);
       printf(&quot;, &quot;);
       printf(&quot;%d&quot;, movies[i].year);
       printf(&quot;, &quot;);
       printf(&quot;%s&quot;, movies[i].genre);
  
   }
  
  
   // close, stringleri nasýl eþitleyeceðini bul.
   int main()
   {
  
       // Buraya kendi dosya pathini lütfen yaz.
       FILE* filePointer = fopen(&quot;movies.csv&quot;, &quot;r&quot;);
  
       if (!filePointer)
       {
           printf(&quot;Can't open file\n&quot;);
       } else {
           fillMovies(filePointer);
           int i = 0;
           while(i &lt; 60){
               printMovie(i);
               i++;
           }
       }
       return 0;
   } 
  </code></pre>