wcstok() function in C++ with example
The wcstok() function is defined in cwchar.h header file. The wcstok() function returns the next token in a null terminated wide string. The pointer delim points to the separator characters i.e. the delimiter.
wchar_t* wcstok(wchar_t* str, const wchar_t* delim, wchar_t ** ptr);
Parameters: This method takes following parameters:
- str: It represents pointer to the null-terminated wide string to tokenize.
- delim: It represents pointer to the null terminated wide string that contains the separators.
- ptr: It represents pointer to an object of type wchar_t*, which is used by wcstok to store its internal state.
Return Value: The wcstok() function returns the pointer to the beginning of next token if there is any. Otherwise it returns zero.
Below program illustrate the above function:
A computer science portal for geeks