C wide string handling: Difference between revisions
No edit summary |
Apoorvanayak (talk | contribs) No edit summary |
||
(3 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
{{C Standard library}} |
{{C Standard library}} |
||
'''wchar.h''' is a [[header file]] in the [[C standard library]] |
'''wchar.h''' is a [[header file]] in the [[C standard library]]. It is a part of the extension to the [[C (programming language)|C programming language]] standard done in 1995. It contains extended multibyte and [[wide character]] utilities. The standard header <wchar.h> is included to perform input and output operations on wide streams. It can also be used to manipulate the wide strings.<ref>http://www.qnx.com/developers/docs/6.4.1/dinkum_en/c99/wchar.html</ref> |
||
==Functions== |
==Functions== |
||
Line 46: | Line 46: | ||
[[ru:Wchar.h]] |
[[ru:Wchar.h]] |
||
[[uk:Wchar.h]] |
[[uk:Wchar.h]] |
||
==References== |
|||
{{reflist}} |
Revision as of 17:04, 13 September 2011
C standard library (libc) |
---|
General topics |
Miscellaneous headers |
wchar.h is a header file in the C standard library. It is a part of the extension to the C programming language standard done in 1995. It contains extended multibyte and wide character utilities. The standard header <wchar.h> is included to perform input and output operations on wide streams. It can also be used to manipulate the wide strings.[1]
Functions
int wcscmp(const wchar_t *s1, const wchar_t *s2)
is the wide-character equivalent of the strcmp(3) function. It compares the wide-character string pointed to by s1 and the wide-character string pointed to by s2.
int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
is the wide-character equivalent of the strncmp function. It is similar to wcscmp(), except it only compares the first n characters of s1.
int wcscasecmp(const wchar_t *s1, const wchar_t *s2)
is the wide-character equivalent of the strcasecmp(3) function. It compares the wide-character string pointed to by s1 and the wide-character string pointed to by s2, ignoring case differences.
int wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
is similar to wcscasecmp(), except it only compares the first n characters of s1.
wcschr
wchar_t *wcschr(const wchar_t *s, wchar_t c);
The function searches for the first element of the wide string s that equals c. It considers the terminating null wide character as part of the wide string. If successful, the function returns the address of the matching element; otherwise, it returns a null pointer.
wcsncat
wchar_t *wcsncat(wchar_t *s1, const wchar_t *s2, size_t n);
The function copies the wide string s2, not including its terminating null wide character, to successive elements of the array that stores the wide string s1, beginning with the element that stores the terminating null wide character of s1. The function copies no more than n wide characters from s2. It then stores a null wide character, in the next element to be altered in s1, and returns s1.
wcsstr
wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
The function searches for the first sequence of elements in the wide string s1 that matches the sequence of elements in the wide string s2, not including its terminating null wide character. If successful, the function returns the address of the matching first element; otherwise, it returns a null pointer.
wcsncpy
wchar_t *wcsncpy(wchar_t *s1, const wchar_t *s2, size_t n);
The function copies the wide string s2, not including its terminating null wide character, to successive elements of the array whose first element has the address s1. It copies no more than n wide characters from s2. The function then stores zero or more null wide characters in the next elements to be altered in s1 until it stores a total of n wide characters. It returns s1.