简体   繁体   中英

What is the difference between “sequence” and “string”?

for example.

mbtowc vs. mbstowcs (stdlib.h) mbrtowc vs. mbsrtowc (wchar.h)

What is the difference between "sequence" and "string"?

In addition, I'd like to know how to use mbstate_t of mbrtowc/mbsrtowc in an example.

In C, a "string" is defined as an array (possibly a subarray of a larger array) of char ending with the null character. The multibyte string functions operate on strings, processing multibyte characters until they reach the end of the string (or run out of space in the destination buffer).

The multibyte character functions that operate on "sequences" of bytes ( char s) convert only a single multibyte character at a time (or, in the case of mbrtowc , possibly even less). There is no requirement that the input char array be a string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM