HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

w
wcstring(3C) wcstring(3C)
Obsolescent Interface
wcstok_r() performs wide character string operations.
EXTERNAL INFLUENCES
Locale
The LC_COLLATE category determines the collation ordering used by the
wcscoll() function.
The
LC_CTYPE category determines how widths are calculated by the
wcwidth() and wcswidth()
functions.
ERRORS
wcswidth() fails if the following condition is encountered:
[EINVAL] ws is NULL or if ws contains an unprintable wide character.
wcsxfrm() fails under the following conditions:
[EINVAL] ws2 points to a string containing wide character codes outside the domain of the col-
lating sequence.
[ENOSYS] if the function
wcsxfrm() is not supported.
EXAMPLES
The following sample piece of code finds the tokens, separated by blanks, that are in the string s (assuming
that there are at most
MAXTOK tokens):
int i = 0;
wchar_t *ws, *wlast, *wtok[MAXTOK];
wtok[0] = wcstok_r(ws, L" ", &wlast);
while (wtok[++i] = wcstok_r(NULL, L" ", &wlast));
APPLICATION USAGE
The Multibyte Support Extension Only prototype of wcstok() is available to applications if
they are
• c99 conformant. (OR)
• Compiled with the -D_XOPEN_SOURCE
macro with the value 500.
The application must also be compiled with the environment variable
UNIX_STD set to the value 98 and
exported to get the Multibyte Support Extension behavior. This manpage previously documented the usage
of the _INCLUDE__STDC_A1_SOURCE
define for this function. This is NOT recommended, and instead
HP strongly recommends using the method described above.
WARNINGS
The functions
wcscat(), wcsncat() , wcscpy(), wcsncpy() , wcstok(), wcsstr(), and
wcstok_r() alter the contents of the array to which ws1 points. They do not check for overflow of the
array.
Null pointers for destination wide strings cause undefined behavior.
Wide character movement is performed differently in different implementations, so copying that involves
overlapping source and destination wide strings may yield unexpected results.
For the wcscoll() function, the results are undefined if the languages specified by the LC_COLLATE
and LC_CTYPE categories use different code sets.
wcstok_r() is an obsolescent interface supported only for compatibility with existing DCE applications.
New multithreaded applications should use wcstok().
wcswidth() will return an incorrect negative value if the number of column positions required for n
wide characters in the wide string pointed to by ws exceeds INT_MAX.
AUTHOR
wcstring functions were developed by OSF and HP.
HP-UX 11i Version 2: December 2007 Update − 3 − Hewlett-Packard Company 635