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
21 The functionality described on this reference page is aligned with the
22 ISO C standard. Any conflict between the requirements described here
23 and the ISO C standard is unintentional. This volume of POSIX.1‐2017
24 defers to the ISO C standard.
25
26 A sequence of calls to wcstok() shall break the wide-character string
27 pointed to by ws1 into a sequence of tokens, each of which shall be
28 delimited by a wide-character code from the wide-character string
29 pointed to by ws2. The ptr argument points to a caller-provided
30 wchar_t pointer into which the wcstok() function shall store informa‐
31 tion necessary for it to continue scanning the same wide-character
32 string.
33
34 The first call in the sequence has ws1 as its first argument, and is
35 followed by calls with a null pointer as their first argument. The sep‐
36 arator string pointed to by ws2 may be different from call to call.
37
38 The first call in the sequence shall search the wide-character string
39 pointed to by ws1 for the first wide-character code that is not con‐
40 tained in the current separator string pointed to by ws2. If no such
41 wide-character code is found, then there are no tokens in the wide-
42 character string pointed to by ws1 and wcstok() shall return a null
43 pointer. If such a wide-character code is found, it shall be the start
44 of the first token.
45
46 The wcstok() function shall then search from there for a wide-character
47 code that is contained in the current separator string. If no such
48 wide-character code is found, the current token extends to the end of
49 the wide-character string pointed to by ws1, and subsequent searches
50 for a token shall return a null pointer. If such a wide-character code
51 is found, it shall be overwritten by a null wide character, which ter‐
52 minates the current token. The wcstok() function shall save a pointer
53 to the following wide-character code, from which the next search for a
54 token shall start.
55
56 Each subsequent call, with a null pointer as the value of the first
57 argument, shall start searching from the saved pointer and behave as
58 described above.
59
60 The implementation shall behave as if no function calls wcstok().
61
63 Upon successful completion, the wcstok() function shall return a
64 pointer to the first wide-character code of a token. Otherwise, if
65 there is no token, wcstok() shall return a null pointer.
66
68 No errors are defined.
69
70 The following sections are informative.
71
73 None.
74
76 None.
77
79 None.
80
82 None.
83
85 The Base Definitions volume of POSIX.1‐2017, <wchar.h>
86
88 Portions of this text are reprinted and reproduced in electronic form
89 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
90 table Operating System Interface (POSIX), The Open Group Base Specifi‐
91 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
92 Electrical and Electronics Engineers, Inc and The Open Group. In the
93 event of any discrepancy between this version and the original IEEE and
94 The Open Group Standard, the original IEEE and The Open Group Standard
95 is the referee document. The original Standard can be obtained online
96 at http://www.opengroup.org/unix/online.html .
97
98 Any typographical or formatting errors that appear in this page are
99 most likely to have been introduced during the conversion of the source
100 files to man page format. To report such errors, see https://www.ker‐
101 nel.org/doc/man-pages/reporting_bugs.html .
102
103
104
105IEEE/The Open Group 2017 WCSTOK(3P)