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.

4
  • strtok_s is C11 standard, by the way. strtok_r is a POSIX2001 standard. Between both of those, there's a standard re-entrant version of strtok for most platforms. Commented Dec 14, 2016 at 9:43
  • 1
    @AndonM.Coleman But this is a c++ question, and in C++ #include <cstring> only includes the c99 version of strtok. So my assumption is that you're just providing this comment as supporting material, demonstrating the implementation specific availability of strtok extensions? Commented Dec 14, 2016 at 12:10
  • 1
    Merely that it's not as non-standard as people might otherwise believe. strtok_s is provided by both C11 and as a standalone extension in Microsoft's C runtime. There's a curious bit of history here where Microsoft's _s functions became the C standard. Commented Dec 14, 2016 at 13:48
  • @AndonM.Coleman Right, I'm with you. Obviously if it's in the C11 standard the interface and implementation have constraints placed upon them which require identical behavior independent of platform. Now the only problem is ensuring that the C11 function is available to us across platforms. Hopefully the C11 standard will be something that C++17 or C++20 chooses to pickup. Commented Dec 14, 2016 at 14:13