Concept
Why is strtok() not reentrant, and what alternative does C provide?
ComputerScienceOne / Tokenizing
"It should be noted that strtok() is not reentrant. It can only work on one string at a time. In a multithreaded application, two threads cannot both use strtok() or they would end up processing each other’s strings. Even in a non-threaded application, we need to be careful. For example, we cannot process a string using strtok() in one function and then call another function that does the same. C does provide a reentrant version, strtok_r() that can be used."
Related Ideas
- How can you tokenize a String in Java?ComputerScienceOne · Tokenizing
- How do sscanf() and sprintf() work with strings?ComputerScienceOne · Tokenizing
- How does PHP compare strings with case-sensitive and case-insensitive functions?ComputerScienceOne · Tokenizing
- How can PHP split strings into tokens using explode() and preg_split()?ComputerScienceOne · Tokenizing
- How can you compare String values in Java?ComputerScienceOne · Tokenizing