How to stringtok this long string ?

I have a string ,

"id,port,password,ssid,delay,flag,class,category "

Please tell me how can stringtok this and find out the "flag" value(0 or 1)?

void setup()
  char input[] = {"id,port,password,ssid,delay,flag"};
  char *ptr;
  ptr = strtok (input, ",");
  while (ptr != NULL)
    ptr = strtok (NULL, ",");

void loop()

sorry ..i have edit my string

What does it look like now ?
Have you tried my example ?

yes its working
but i was added 'class' and 'category' in my string

i was added 'class' and 'category' in my string

As you have discovered the example does not care how many elements you have in the string as long as it is delimited by commas

As you haven’t discovered -
Please extend the thread, don’t edit original posts...