wstring(3W) wstring(3W)
NAME
wstring: wscat, wsncat, wscmp, wsncmp, wscpy, wsncpy, wslen,
wschr, wsrchr, wspbrk, wsspn, wscspn, wstok, wstostr, strtows
- wchar_t string operations and type transformation
SYNOPSIS
#include <widec.h>
wchar_t *wscat(wchar_t *s1, const wchar_t *s2);
wchar_t *wsncat(wchar_t *s1, const wchar_t *s2, int n);
int wscmp(const wchar_t *s1, const wchar_t *s2);
int wsncmp(const wchar_t *s1, const wchar_t *s2, int n);
wchar_t *wscpy(wchar_t *s1, const wchar_t *s2);
wchar_t *wsncpy(wchar_t *s1, const wchar_t *s2, int n);
int wslen(const wchar_t *s);
wchar_t *wschr(const wchar_t *s, int c);
wchar_t *wsrchr(const wchar_t *s, int c);
wchar_t *wspbrk(const wchar_t *s1, const wchar_t *s2);
int wsspn(const wchar_t *s1, const wchar_t *s2);
int wscspn(const wchar_t *s1, const wchar_t *s2);
wchar_t *wstok(wchar_t *s1, const wchar_t *s2);
char *wstostr(char *s1, const wchar_t *s2);
wchar_t *strtows(wchar_t *s1, const char *s2);
DESCRIPTION
The arguments s1, s2, and s point to wchar_t strings (that is,
arrays of wchar_t characters terminated by a wchar_t null
character). The functions wscat, wsncat, wscpy, and wsncpy
all modify s1. These functions do not check for an overflow
condition of the array pointed to by s1.
wscat appends a copy of the wchar_t string s2 to the end of
the wchar_t string s1. wsncat appends at most n wchar_t
characters. Each function returns s1.
wscmp compares its arguments and returns an integer less than,
equal to, or greater than 0, depending on whether s1 is less
than, equal to, or greater than s2. wsncmp makes the same
comparison but looks at most at n wchar_t characters.
wscpy copies wchar_t string s2 to s1, stopping after the
wchar_t null character has been copied. wsncpy copies exactly
n wchar_t characters, truncating s2 or adding wchar_t null
characters to s1, if necessary. The result will not be
wchar_t null-terminated if the length of s2 is n or more.
Each function returns s1.
Copyright 1994 Novell, Inc. Page 1
wstring(3W) wstring(3W)
wslen returns the number of wchar_t characters in s, not
including the terminating wchar_t null character.
wschr and wsrchr return a pointer to the first and last
occurrence, respectively, of wchar_t character c in wchar_t
string s, or a null pointer, if c does not occur in the
string. The wchar_t null character terminating a string is
considered to be part of the string.
wspbrk returns a pointer to the first occurrence in wchar_t
string s1 of any wchar_t character from wchar_t string s2, or
a null pointer if there is no wchar_t character from s2 in s1.
wsspn returns the length of the initial segment of wchar_t
string s1, which consists entirely of wchar_t characters from
wchar_t string s2. wscspn returns the length of the initial
segment of wchar_t string s1, which does not consist entirely
of wchar_t characters from wchar_t string s2.
wstok treats the wchar_t string s1 as a sequence of zero or
more text tokens, separated by spans of one or more wchar_t
characters from the separator wchar_t string s2. The first
call (with the pointer s1 specified) returns a pointer to the
first wchar_t character of the first token, and writes a
wchar_t null character into s1 immediately following the
returned token. The function keeps track of its position in
the wchar_t string between separate calls, so that subsequent
calls (which must be made with the first argument a null
pointer) will progress through the wchar_t string s1
immediately following that token. Similarly, subsequent calls
will progress through the wchar_t string s1 until no tokens
remain. The wchar_t separator string s2 may be different from
call to call. A null pointer is returned when no token
remains in s1.
wstostr transforms wchar_t characters in wchar_t string s2
into EUC, and transfers them to character string s1, stopping
after the wchar_t null character has been processed.
strtows transforms EUC in character string s2 into wchar_t
characters, and transfers those to wchar_t string s1, stopping
after the null character has been processed.
Errors
On success, wstostr and strtows return s1. If an illegal byte
sequence is detected, a null pointer is returned and errno is
Copyright 1994 Novell, Inc. Page 2
wstring(3W) wstring(3W)
set to EILSEQ.
NOTICES
Use the equivalent wcs* functions as documented in section 3C.
REFERENCES
malloc(3C), widec(3S)
Copyright 1994 Novell, Inc. Page 3