Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 3
    Note that strtok modifes the string you're checking, so you can't use it on const char * strings without making a copy. Commented Sep 10, 2008 at 13:53
  • 9
    The multithreading issue is that strtok uses a global variable to keep track of where it is, so if you have two threads that each use strtok, you'll get undefined behavior.
    – JohnMcG
    Commented Sep 10, 2008 at 15:09
  • @JohnMcG Or just use strtok_s which is basically strtok with explicit state passing.
    – Matthias
    Commented Jun 2, 2018 at 16:51