wcstok()

get next token from wide character string 

Function


SYNOPSIS

#include <wchar.h>

wchar_t *wcstok(wchar_t *ws1, const wchar_t *ws2, wchar_t **ptr);


DESCRIPTION

The wcstok() function is used to break a wide character string ws1 into tokens each of which is delimited by a wide character which belongs to the string pointed to by ws2. The third argument ptr points to a user-defined pointer which is used by wcstok() to store information needed to continue scanning the same wide character string.

The first call to wcstok() takes the string pointed to by ws1 as the first parameter. For all subsequent calls a NULL pointer is passed in as the first parameter. The character set pointed to by ws2 can change from call to call.

The first time wcstok() is called it searches the string pointed to by ws1 for the first character not in the string pointed to by ws2. If such a character is found it becomes the beginning of the first token, otherwise a NULL pointer is returned by wcstok(). If such a character is found the wcstok() function continues searching until it finds a character that is in the string pointed to by ws2. If this character is found it is overwritten by a NULL character which ends the current token. The wcstok() functions saves a pointer to the next wide character and the search for the next token begins here. If a character in ws2 is not found and the search extends to the end of ws1, then subsequent calls to wcstok() return a NULL pointer.

Each of the following calls to wcstok() with a NULL as the first parameter begins the search at the saved position and acts as described earlier.


PARAMETERS

ws1 

Points to the string from which to extract tokens.

ws2 

Points to a null-terminated set of delimiter characters.

ptr 

Is a value-return parameter used by wcstok() to record its progress through ws1.


RETURN VALUES

The wcstok() function returns a pointer to the first character of a token if the function completed successfully, otherwise a NULL pointer is returned.


CONFORMANCE

ANSI/ISO 9899-1990/AM 1-1995.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
wcscspn(), wcsspn()


PTC MKS Toolkit 10.4 Documentation Build 39.