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

w
wcstring(3C) wcstring(3C)
errno to [EINVAL] (if the wide character string pointed to by ws2 contains wide-character codes outside
the domain of the collating sequence) or to [ENOSYS] (if the function is not supported).
Definitions for these functions and the type
wchar_t are provided in header file <wchar.h> .
Obsolescent Interface
wcstok_r() performs wide character string operations.
APPLICATION USAGE
The "Unix Standards Only" prototypes are available to applications if they are:
a.
c99 conformant.
b. Compiled with
-D_XOPEN_SOURCE
macro with a value >=500.
c. Compiled with
-D_POSIX_C_SOURCE
macro with a value >= 200112.
To get the MSE behavior of the "Unix Standards Only" prototype of
wcstok(), the application MUST be
compiled with the environment variable
UNIX_STD set to the value 98 or above and exported.
EXTERNAL INFLUENCES
Environment Variables
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));
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.
HP-UX 11i Version 3: February 2007 3 Hewlett-Packard Company 657