title: Arduino Error: cannot convert 'String' to 'char*' for argument '1' to 'char* strtok(char*, const char*)'
body: <p>I'm working on an arduino assignment that splits an incoming string and puts the terms of the string in 6 different variables( a sample input string when split up has 6 terms). i have the following error popping up: cannot convert 'String' to 'char*' for argument '1' to 'char* strtok(char*, const char*)' . Can you guys suggest changes to the code to get it right ? </p>
  
  <pre><code>String str(" ");
  char a[5],b[5],c[5],d[5],e[5],f[5];
  char *token = strtok(str, " ");
  
  
  void setup()
  {
  Serial.begin(9600);
  
   }
  void loop(){
  while (!Serial.available());
  str = Serial.readStringUntil('\n');
  Serial.println(str);
  
  strcpy(a,token);
  
  token = strtok(NULL, " ");
  strcpy(b,token);
  token = strtok(NULL, " ");
  strcpy(c,token);
  token = strtok(NULL, " ");
  strcpy(d,token);
  token = strtok(NULL, " ");
  strcpy(e,token);
  token = strtok(NULL, " ");
  strcpy(f,token);
  
  Serial.println(a);
  Serial.println(b);
  Serial.println(c);
  Serial.println(d);
  Serial.println(e);
  Serial.println(f);
  }
  
  enter code here
  </code></pre>