12.1.25. string.h and wchar.h. Altium TriCore
Διαφήμιση
Διαφήμιση
Libraries
wcstombs(*s,*pwcs,n)
Converts a sequence of wide characters in the array pointed to by pwcs into multi-byte characters and stores at most n multi-byte characters into the string pointed to by s. (See also wc srtowmb
in
).
12.1.25. string.h and wchar.h
This header file provides numerous functions for manipulating strings. By convention, strings in C are arrays of characters with a terminating null character. Most functions therefore take arguments of type
*char
. However, many functions have also parallel wide-character functions which take arguments of type
*wchar_t
. These functions are declared in wchar.h
.
Copying and concatenation functions string.h
wchar.h
Description
memcpy(*s1,*s2,n) wmemcpy(*s1,*s2,n)
Copies n characters from *s2 into *s1 and returns *s1. If
*s1 and *s2 overlap the result is undefined.
memmove(*s1,*s2,n) wmemmove(*s1,*s2,n)
Same as memcpy
, but overlapping strings are handled correctly. Returns *s1.
strcpy(*s1,*s2) wcscpy(*s1,*s2)
Copies *s2 into *s1 and returns *s1. If *s1 and *s2 overlap the result is undefined.
strncpy(*s1,*s2,n) wcsncpy(*s1,*s2,n)
Copies not more than n characters from *s2 into *s1 and returns *s1. If *s1 and *s2 overlap the result is undefined.
strcat(*s1,*s2) wcscat(*s1,*s2)
Appends a copy of *s2 to *s1 and returns *s1. If *s1 and
*s2 overlap the result is undefined.
strncat(*s1,*s2,n) wcsncat(*s1,*s2,n)
Appends not more than n characters from *s2 to *s1 and returns *s1. If *s1 and *s2 overlap the result is undefined.
Comparison functions string.h
wchar.h
Description
memcmp(*s1,*s2,n) wmemcmp(*s1,*s2,n)
Compares the first n characters of *s1 to the first n characters of *s2. Returns < 0 if *s1 < *s2, 0 if *s1 = = *s2, or > 0 if *s1 > *s2.
strcmp(*s1,*s2) wcscmp(*s1,*s2)
Compares string *s1 to *s2. Returns < 0 if *s1 < *s2, 0 if *s1
= = *s2, or > 0 if *s1 > *s2.
strncmp(*s1,*s2,n) wcsncmp(*s1,*s2,n)
Compares the first n characters of *s1 to the first n characters of *s2. Returns < 0 if *s1 < *s2, 0 if *s1 = = *s2, or > 0 if *s1 > *s2.
strcoll(*s1,*s2) wcscoll(*s1,*s2)
Performs a local-specific comparison between string *s1 and string *s2 according to the LC_COLLATE category of the current locale. Returns < 0 if *s1 < *s2, 0 if *s1 = = *s2,
or > 0 if *s1 > *s2. (See Section 12.1.14, locale.h )
719
Λήψη
Διαφήμιση