WCSTOK(3POSIX)
π WCSTOK(3POSIX) π
okay bestie, welcome to the POSIX Programmer's Manual β¨ this one's WCSTOK(3POSIX), and it's all about splitting wide-character strings into lil tokens. sit down, grab a strawberry π, let's go.
πΈ PROLOG πΈ
so real talk first: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (like, go check the corresponding Linux manual page for the deets on Linux behavior, fr), or honestly the interface may not even be implemented on Linux. π
β¨ NAME β¨
wcstok β split a wide-character string into tokens π
π SYNOPSIS π
#include <wchar.h>
wchar_t *wcstok(wchar_t *restrict ws1, const wchar_t *restrict ws2,
wchar_t **restrict ptr);
π¦ DESCRIPTION π¦
the functionality described on this reference page is aligned with the ISO C standard. any conflict between the requirements described here and the ISO C standard is unintentional β no drama intended. this volume of POSIX.1β2017 defers to the ISO C standard. periodt.
a sequence of calls to wcstok() shall break the wide-character string pointed to by ws1 into a sequence of tokens, and each of those tokens shall be delimited by a wide-character code from the wide-character string pointed to by ws2. the ptr argument points to a caller-provided wchar_t pointer, and that's where wcstok() shall store the info it needs to keep scanning the same wide-character string. it's giving bookmark energy, honestly. π
the first call in the sequence has ws1 as its first argument, and then it's followed by calls with a null pointer as their first argument. and the separator string pointed to by ws2? it may be different from call to call. no commitment, iconic behavior. π
the first call in the sequence shall search the wide-character string pointed to by ws1 for the first wide-character code that is not contained in the current separator string pointed to by ws2. if no such wide-character code is found, then there are no tokens in the wide-character string pointed to by ws1 and wcstok() shall return a null pointer. if such a wide-character code is found, it shall be the start of the first token. π«Ά
then the wcstok() function shall search from there for a wide-character code that is contained in the current separator string. if no such wide-character code is found, the current token extends to the end of the wide-character string pointed to by ws1, and subsequent searches for a token shall return a null pointer. if such a wide-character code is found, it shall be overwritten by a null wide character, which terminates the current token. then wcstok() shall save a pointer to the following wide-character code, and that's where the next search for a token shall start. main character move. π
each subsequent call, with a null pointer as the value of the first argument, shall start searching from the saved pointer and behave as described above. same vibe, new search. β¨
the implementation shall behave as if no function calls wcstok().
π RETURN VALUE π
upon successful completion, the wcstok() function shall return a pointer to the first wide-character code of a token. otherwise, if there is no token, wcstok() shall return a null pointer. so like, no token = nothing to show, sorry babe. π
π ERRORS π
no errors are defined. we love a low-maintenance function. π
the following sections are informative. (yes bestie, informative, not normative β noted.)
π EXAMPLES π
none. π
π§ APPLICATION USAGE π§
none. π
β RATIONALE β
none. π
π FUTURE DIRECTIONS π
none. π₯
πΈ SEE ALSO πΈ
- the Base Definitions volume of POSIX.1β2017,
<wchar.h>
π COPYRIGHT π
portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
ngl bestie, that's the whole page β every option, every null pointer, every vibe, all intact. no cap. π«Ά
and that's a wrap from IEEE/The Open Group, 2017 β¨ mwah, go split some wide-character strings responsibly π π
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms