title: C Multiple Strtok to determine delimiter
body: <p>I'm writing a C program where the user can input a string of 1-3 digits followed by a backslash and then another 1-3 digits or they can enter 1-3 digits, followed by a comma, then another 1-3 digits and there is no limit to how many times they can iterate this.</p>
  
  <p>I need to determine whether the input delimiter is a backslash or comma (to determine what to do with the numbers) and put the numbers into an array.  </p>
  
  <p>The way I was thinking of doing this was to using strtok as follows. The string is inputted as char *token.</p>
  
  <pre><code>op_tok1 = strtok(token, "\\");
  if(op_tok1 != NULL)
  {
          /* Process numbers */
          return;
  }
  
  op_tok2 = strtok(token, ",");
  if(op_tok2 != NULL)
  {
      /* Process other numbers */
      return;
  }
  </code></pre>
  
  <p>This works for anything delimetered with a backslash, but not with a comma. I believe this is because strtok messes with the token variable. Is this true? Is there a better way to go about this? thanks!</p>