title: How to parse a .csv file with quotation marks in C
body: <p>Lets say the string im trying to parse reads</p>
  
  <blockquote>
    <p>"Smith, John",Data1,Data2,Data3</p>
  </blockquote>
  
  <p>I could also get lines that read </p>
  
  <blockquote>
    <p>Dave, Data1,Data2,Data3</p>
  </blockquote>
  
  <p>so I have the if statement </p>
  
  <p>line is the line of text <code>fgets()</code>'d from the file, but I think that works</p>
  
  <p>The rest I've been struggling with for about an hour or so now. I'm trying to reformat the "Smith, John" so its John Smith, then assign it to recTemp.artist</p>
  
  <pre><code>if (line[0] == '\"') {
      //Read the last name, first name",
      char lastTemp[30] = "";
      char firstTemp[30] = "";
      strcpy(lastTemp , strtok(line, ", "));
      strcpy(firstTemp, strtok(NULL, "\","));
      char * t;
      t = strstr(lastTemp, "\"");
      strcpy(t, " ");
      //Concatenate each string assign to the artist value
      strcat(firstTemp, lastTemp);
      strcpy(recTemp.artist, firstTemp);
  }
  </code></pre>
  
  <p>I think the error comes from the strstr call or the strcpy right after it, but I'm not sure </p>
  
  <p>Thanks!</p>