_mbstok
- Updated2023-02-21
- 2 minute(s) read
_mbstok
char *_mbstok (char stringToSeparate[], const char setOfDelimiters[]);
Purpose
Breaks a string into tokens, which are separated by one or more characters from the specified set of delimiters. To find all tokens in a string, you must call _mbstok in a loop, once for each token. The first call has the original string as the first argument, followed by subsequent calls with a NULL pointer as their first argument. The set of delimiters can vary from call to call. If a character in the delimiter set is found, it is overwritten by an ASCII NUL byte, which terminates the current token. A pointer to the character following the delimiter is saved, from which the next search for a token will start.
Refer to the Programming for Multibyte Character Sets in LabWindows/CVI topic for information about working with multibyte character sets.
Parameters
Input | ||||
Name | Type | Description | ||
stringToSeparate | char [] |
Contains a pointer to the string that is separated into tokens. Any character in this string that matches one found in the specified
set of delimiters is overwritten with an ASCII NUL byte. In order to find all of the tokens in a string, enter NULL into this parameter on subsequent calls.
|
||
setOfDelimiters | const char [] | Contains the set of delimiters that are searched for in the specified string. During a sequence of calls in which all tokens for a string are found, the contents of this set can vary. |
Return Value
Name | Type | Description |
currentToken | char * | Contains a pointer to the first character of the current token or a NULL pointer if there is no token. |
Additional Information
Library: ANSI C Library
Include file: ansi_c.h
LabWindows/CVI compatibility: LabWindows/CVI 6.0 and later