diff options
author | tjr <tjr@FreeBSD.org> | 2002-10-02 14:28:26 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-10-02 14:28:26 +0000 |
commit | b4a2b3a8152e35d09c7d21bca02ab3d55e5986ba (patch) | |
tree | ac94c558eb37f60df08bcbbddfec31571dbe1f3a | |
parent | 2f634c2c49c01438953b109e73808d60957791ae (diff) | |
download | FreeBSD-src-b4a2b3a8152e35d09c7d21bca02ab3d55e5986ba.zip FreeBSD-src-b4a2b3a8152e35d09c7d21bca02ab3d55e5986ba.tar.gz |
Add an example showing how to use wcstok(). Fix ordering of See Also section.
-rw-r--r-- | lib/libc/string/wcstok.3 | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/libc/string/wcstok.3 b/lib/libc/string/wcstok.3 index 9d62864..3f4c53e 100644 --- a/lib/libc/string/wcstok.3 +++ b/lib/libc/string/wcstok.3 @@ -49,7 +49,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 7, 2002 +.Dd October 3, 2002 .Dt WCSTOK 3 .Os .Sh NAME @@ -96,6 +96,19 @@ function returns a pointer to the beginning of each subsequent token in the string, after replacing the token itself with a null wide character (L'\e0'). When no more tokens remain, a null pointer is returned. +.Sh EXAMPLES +The following code fragment splits a wide character string on +.Tn ASCII +space, tab and newline characters and writes the tokens to +standard output: +.Bd -literal -offset indent +const wchar_t *seps = L" \et\en"; +wchar_t *last, *tok, text[] = L" \enone\ettwo\et\etthree \en"; + +for (tok = wcstok(text, seps, &last); tok != NULL; + tok = wcstok(NULL, seps, &last)) + wprintf(L"%ls\en", tok); +.Ed .Sh COMPATIBILITY Some early implementations of .Fn wcstok @@ -106,12 +119,12 @@ and maintain state across calls in a static variable like .Fn strtok does. .Sh SEE ALSO +.Xr strtok 3 , .Xr wcschr 3 , .Xr wcscspn 3 , .Xr wcspbrk 3 , .Xr wcsrchr 3 , .Xr wcsspn 3 , -.Xr strtok 3 .Sh STANDARDS The .Fn wcstok |