1WCSTOK(P)                  POSIX Programmer's Manual                 WCSTOK(P)
2
3
4

NAME

6       wcstok - split a wide-character string into tokens
7

SYNOPSIS

9       #include <wchar.h>
10
11       wchar_t *wcstok(wchar_t *restrict ws1, const wchar_t *restrict ws2,
12              wchar_t **restrict ptr);
13
14

DESCRIPTION

16       A  sequence  of calls to wcstok() shall break the wide-character string
17       pointed to by ws1 into a sequence of tokens, each  of  which  shall  be
18       delimited  by  a  wide-character  code  from  the wide-character string
19       pointed to by ws2. The ptr argument points to a caller-provided wchar_t
20       pointer into which the wcstok() function shall store information neces‐
21       sary for it to continue scanning the same wide-character string.
22
23       The first call in the sequence has ws1 as its first  argument,  and  is
24       followed by calls with a null pointer as their first argument. The sep‐
25       arator string pointed to by ws2 may be different from call to call.
26
27       The first call in the sequence shall search the  wide-character  string
28       pointed  to  by  ws1 for the first wide-character code that is not con‐
29       tained in the current separator string pointed to by ws2.  If  no  such
30       wide-character  code  is  found,  then there are no tokens in the wide-
31       character string pointed to by ws1 and wcstok()  shall  return  a  null
32       pointer.  If such a wide-character code is found, it shall be the start
33       of the first token.
34
35       The wcstok() function shall then search from there for a wide-character
36       code  that  is  contained  in  the current separator string. If no such
37       wide-character code is found, the current token extends to the  end  of
38       the  wide-character  string  pointed to by ws1, and subsequent searches
39       for a token shall return a null pointer. If such a wide-character  code
40       is  found, it shall be overwritten by a null wide character, which ter‐
41       minates the current token. The wcstok() function shall save  a  pointer
42       to  the following wide-character code, from which the next search for a
43       token shall start.
44
45       Each subsequent call, with a null pointer as the  value  of  the  first
46       argument,  shall  start  searching from the saved pointer and behave as
47       described above.
48
49       The implementation shall behave as if no function calls wcstok().
50

RETURN VALUE

52       Upon successful  completion,  the  wcstok()  function  shall  return  a
53       pointer  to  the  first  wide-character code of a token.  Otherwise, if
54       there is no token, wcstok() shall return a null pointer.
55

ERRORS

57       No errors are defined.
58
59       The following sections are informative.
60

EXAMPLES

62       None.
63

APPLICATION USAGE

65       None.
66

RATIONALE

68       None.
69

FUTURE DIRECTIONS

71       None.
72

SEE ALSO

74       The Base Definitions volume of IEEE Std 1003.1-2001, <wchar.h>
75
77       Portions of this text are reprinted and reproduced in  electronic  form
78       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
79       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
80       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
81       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
82       event of any discrepancy between this version and the original IEEE and
83       The Open Group Standard, the original IEEE and The Open Group  Standard
84       is  the  referee document. The original Standard can be obtained online
85       at http://www.opengroup.org/unix/online.html .
86
87
88
89IEEE/The Open Group                  2003                            WCSTOK(P)
Impressum