📄 mbtowc.c
字号:
/*FUNCTION<<mbtowc>>---minimal multibyte to wide char converterINDEX mbtowcANSI_SYNOPSIS #include <stdlib.h> int mbtowc(wchar_t *<[pwc]>, const char *<[s]>, size_t <[n]>);TRAD_SYNOPSIS #include <stdlib.h> int mbtowc(<[pwc]>, <[s]>, <[n]>) wchar_t *<[pwc]>; const char *<[s]>; size_t <[n]>;DESCRIPTIONThis is a minimal ANSI-conforming implementation of <<mbtowc>>. Theonly ``multi-byte character sequences'' recognized are single bytes,and they are ``converted'' to themselves.Each call to <<mbtowc>> copies one character from <<*<[s]>>> to<<*<[pwc]>>>, unless <[s]> is a null pointer.In this implementation, the argument <[n]> is ignored.RETURNSThis implementation of <<mbtowc>> returns <<0>> if<[s]> is <<NULL>>; it returns <<1>> otherwise (reporting the length ofthe character ``sequence'' used).PORTABILITY<<mbtowc>> is required in the ANSI C standard. However, the preciseeffects vary with the locale.<<mbtowc>> requires no supporting OS subroutines.*/#include <stdlib.h>int_DEFUN (mbtowc, (pwc, s, n), wchar_t *pwc _AND const char *s _AND size_t n){ if (s == NULL) return 0; if (n == 0) return -1; if (pwc) *pwc = (wchar_t) *s; return (*s != '\0');}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -