Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by sciSpider v2.1 (sch jbop) (X_X)@==(Q_Q)@

Wiki Markup
The C99 \[[ISO/IEC 9899-:1999|AA. C References#ISO/IEC 9899-1999]\] function {{strtok()}} is a string tokenization function that takes three arguments: an initial string to be parsed, a const-qualified character delimiter, and a pointer to a pointer to modify to return the result.

The first time strtok() is called, the string is parsed into tokens, character delimiter, and address of the variable in which to return the result are passed as arguments. The strtok() function parses the string up to the first instance of the delimiter character, replaces the character in place with a NULL byte ('\0'), and puts the address of the first character in the token to the passed-in variable. Subsequent calls to strtok() begin parsing immediately after the most recently-placed NULL null character.

Because strtok() modifies its argument, the string is subsequently unsafe and cannot be used in its original form. If you need to preserve the original string, copy it into a buffer and pass the address of the buffer to strtok() instead of the original string.

...

Wiki Markup
\[[ISO/IEC 9899-:1999|AA. C References#ISO/IEC 9899-1999]\] Section 7.21.5.8, "The strtok function"
\[[Linux 07|AA. C References#Linux 07]\] [strtok(3)|http://www.kernel.org/doc/man-pages/online/pages/man3/strtok.3.html]

...