1WCSTOK(3P) POSIX Programmer's Manual WCSTOK(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 wcstok - split a wide-character string into tokens
13
15 #include <wchar.h>
16
17 wchar_t *wcstok(wchar_t *restrict ws1, const wchar_t *restrict ws2,
18 wchar_t **restrict ptr);
19
20
22 A sequence of calls to wcstok() shall break the wide-character string
23 pointed to by ws1 into a sequence of tokens, each of which shall be
24 delimited by a wide-character code from the wide-character string
25 pointed to by ws2. The ptr argument points to a caller-provided wchar_t
26 pointer into which the wcstok() function shall store information neces‐
27 sary for it to continue scanning the same wide-character string.
28
29 The first call in the sequence has ws1 as its first argument, and is
30 followed by calls with a null pointer as their first argument. The sep‐
31 arator string pointed to by ws2 may be different from call to call.
32
33 The first call in the sequence shall search the wide-character string
34 pointed to by ws1 for the first wide-character code that is not con‐
35 tained in the current separator string pointed to by ws2. If no such
36 wide-character code is found, then there are no tokens in the wide-
37 character string pointed to by ws1 and wcstok() shall return a null
38 pointer. If such a wide-character code is found, it shall be the start
39 of the first token.
40
41 The wcstok() function shall then search from there for a wide-character
42 code that is contained in the current separator string. If no such
43 wide-character code is found, the current token extends to the end of
44 the wide-character string pointed to by ws1, and subsequent searches
45 for a token shall return a null pointer. If such a wide-character code
46 is found, it shall be overwritten by a null wide character, which ter‐
47 minates the current token. The wcstok() function shall save a pointer
48 to the following wide-character code, from which the next search for a
49 token shall start.
50
51 Each subsequent call, with a null pointer as the value of the first
52 argument, shall start searching from the saved pointer and behave as
53 described above.
54
55 The implementation shall behave as if no function calls wcstok().
56
58 Upon successful completion, the wcstok() function shall return a
59 pointer to the first wide-character code of a token. Otherwise, if
60 there is no token, wcstok() shall return a null pointer.
61
63 No errors are defined.
64
65 The following sections are informative.
66
68 None.
69
71 None.
72
74 None.
75
77 None.
78
80 The Base Definitions volume of IEEE Std 1003.1-2001, <wchar.h>
81
83 Portions of this text are reprinted and reproduced in electronic form
84 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
85 -- Portable Operating System Interface (POSIX), The Open Group Base
86 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
87 Electrical and Electronics Engineers, Inc and The Open Group. In the
88 event of any discrepancy between this version and the original IEEE and
89 The Open Group Standard, the original IEEE and The Open Group Standard
90 is the referee document. The original Standard can be obtained online
91 at http://www.opengroup.org/unix/online.html .
92
93
94
95IEEE/The Open Group 2003 WCSTOK(3P)