Previous | Table of Contents | Next |
3.10.17.1. Wide String Functions
size_t wcslen(const wchar_t *s) wchar_t *wcscpy(wchar_t *dest, const wchar_t *src) wchar_t *wcscat(wchar_t *dest, const wchar_t *src) wchar_t *wcsncpy(wchar_t *dest, const wchar_t *src, size_t n) wchar_t *wcsncat(wchar_t *dest, const wchar_t *src, size_t n) int wcscmp(const wchar_t *s1, const wchar_t *s2) int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n) int wcscoll(const wchar_t *s1, const wchar_t *s2) size_t wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n) wchar_t *wcschr(const wchar_t *s, wchar_t c) wchar_t *wcsrchr(const wchar_t *s, wchar_t c) wchar_t *wcsstr(const wchar_t *s, const wchar_t *pat) size_t wcsspn(const wchar_t *s, const wchar_t *set) size_t wcscspn(const wchar_t *s, const wchar_t *set) wchar_t *wcspbrk(const wchar_t *s, const wchar_t *set)
These functions all perform analogous operations to those in sections 3.10.2.1 to 3.10.2.4, except that they work with strings of (that is, arrays of or pointers to) type wchar_t instead of char. Each function wcsxxx performs a function analogous to strxxx. For example, wcscpy copies a string of wide characters from src to dest. Where a character count parameter n appears, it is interpreted as a number of wide characters.
3.10.17.2. Operations on Blocks of Wide Characters
wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t n) wchar_t *wmemmove(wchar_t *dest, const wchar_t *src, size_t n) int wmemcmp(const wchar_t *p1, const wchar_t *p2, size_t n) wchar_t *wmemchr(const wchar_t *p, wchar_t c, size_t n) wchar_t *wmemset(wchar_t *p, wchar_t c, size_t n)
These functions all perform analogous operations to those in section 3.10.2.5, except that they work with blocks of wide characters instead of characters. Each function wmemxxx performs a function analogous to memxxx, with n interpreted as a number of wide characters.
3.10.17.3. Wide String Numeric Conversions
long int wcstol(const wchar_t *s, wchar_t **endp, int base) unsigned long int wcstoul(const wchar_t *s, wchar_t **endp, int base) double wcstod(const wchar_t *s, wchar_t **endp)
These functions all perform analogous operations to those in section 3.10.4.2, except that they work with strings of type wchar_t instead of char. Each function wcsxxx performs a function analogous to strxxx.
3.10.17.4. Wide String Time Conversion
size_t wcsftime(wchar_t *buf, size_t bufsize, const wchar_t *fmt, const struct tm *tp)
wcsftime performs the analogous operation to strftime (see section 3.10.6.7) except that the format string fmt, destination buffer buf, and destination buffer size bufsize all involve wide characters.
3.10.17.5. Wide String Tokenization
wchar_t *wcstok(wchar_t *s, const wchar_t *sep, wchar_t **state)
wcstok performs the analogous operation to strtok (see section 3.10.2.6) except that the string being split (s), the string of separator characters (sep), and the return value are all strings of wide characters. The third argument, state, is a pointer to a caller-supplied object of type wchar_t *; wcstok uses this object to save its state between calls, and so does not suffer the nonreentrancy that strtok does.
3.10.17.6. Wide String Input and Output
getwchar, getwc, fgetwc
wint_t getwchar(void) wint_t getwc(FILE *fp) wint_t fgetwc(FILE *fp)
These functions read wide characters, either from standard input or the stream fp, implicitly converting from multibyte character sequences as if by calling mbrtowc. WEOF is returned on end-of-file. The functions are otherwise equivalent to getchar, getc, and fgetc, as described in section 3.10.1.2.
putwchar, putwc, fputwc
wint_t putwchar(wchar_t c) wint_t putwc(wchar_t c, FILE *fp) wint_t fputwc(wchar_t c, FILE *fp)
These functions write wide characters, either to standard output or the stream fp, implicitly converting to multibyte character sequences as if by calling wcrtomb. The functions are otherwise equivalent to putchar, putc, and fputc, as described in section 3.10.1.2.
wprintf, fwprintf
int wprintf(const wchar_t *, ) int fwprintf(FILE *fp, const wchar_t *, )
These functions are equivalent to printf and fprintf (see section 3.10.1.2) except that the format string fmt is of wide characters, and the stream being written (either stdout or fp) is treated as a multibyte character sequence, as if by calling fputwc. In the format string, the %c and %s specifiers continue to expect parameters that are simple character values and strings of char, respectively. To print wide characters or strings of wide characters, use the new specifiers %lc and %ls.
wscanf, fwscanf
int wscanf(const wchar_t *, ) int fwscanf(FILE *fp, const wchar_t *, )
These functions are equivalent to scanf and fscanf (see section 3.10.1.2) except that the format string fmt is of wide characters, and the stream being read (either stdin or fp) is treated as a multibyte character sequence, as if by calling fgetwc. In the format string, the %c, %s, and %[ specifiers read wide characters but store them, as if by calling wcrtomb, to char * arguments. To read wide characters or strings as wide characters (that is, to wchar_t * arguments), use the new specifiers %lc, %ls, and %l[.
fgetws, fputws
wchar_t *fgetws(wchar_t *, int, FILE *fp) int fputws(const wchar_t *, FILE *fp)
These functions read or write lines of text, analogously to the fgets and fputs functions of section 3.10.1.2, except that wide characters are read or written, as if by calling fgetwc or fputwc.
ungetwc
wint_t ungetwc(wint_t c, FILE *fp)
ungetwc pushes the wide character c back on the input stream fp, analogously to ungetc (see section 3.10.1.2).
Previous | Table of Contents | Next |