This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

89
cppdraft/c/mb/wcs.md Normal file
View File

@@ -0,0 +1,89 @@
[c.mb.wcs]
# 28 Text processing library [[text]](./#text)
## 28.7 Null-terminated sequence utilities [[text.c.strings]](text.c.strings#c.mb.wcs)
### 28.7.5 Multibyte / wide string and character conversion functions [c.mb.wcs]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L13295)
[*Note [1](#note-1)*:
The headers [<cstdlib>](cstdlib.syn#header:%3ccstdlib%3e "17.2.2Header <cstdlib> synopsis[cstdlib.syn]"),[<cuchar>](cuchar.syn#header:%3ccuchar%3e "28.7.4Header <cuchar> synopsis[cuchar.syn]"),
and [<cwchar>](cwchar.syn#header:%3ccwchar%3e "28.7.3Header <cwchar> synopsis[cwchar.syn]") declare the functions described in this subclause[.](#1.sentence-1)
— *end note*]
[🔗](#lib:mbsinit)
`int mbsinit(const mbstate_t* ps);
int mblen(const char* s, size_t n);
size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n);
size_t wcstombs(char* s, const wchar_t* pwcs, size_t n);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L13315)
*Effects*: These functions have the semantics specified in the C standard library[.](#2.sentence-1)
See also: ISO/IEC 9899:2024, 7.22.7.1, 7.22.8, 7.29.6.2.1
[🔗](#lib:mbtowc)
`int mbtowc(wchar_t* pwc, const char* s, size_t n);
int wctomb(char* s, wchar_t wchar);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L13330)
*Effects*: These functions have the semantics specified in the C standard library[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L13334)
*Remarks*: Calls to these functions
may introduce a data race ([[res.on.data.races]](res.on.data.races "16.4.6.10Data race avoidance"))
with other calls to the same function[.](#4.sentence-1)
See also: ISO/IEC 9899:2024, 7.22.7
[🔗](#itemdecl:3)
`size_t [mbrlen](#lib:mbrlen "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(const char* s, size_t n, mbstate_t* ps);
size_t [mbrtowc](#lib:mbrtowc "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(wchar_t* pwc, const char* s, size_t n, mbstate_t* ps);
size_t [wcrtomb](#lib:wcrtomb "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(char* s, wchar_t wc, mbstate_t* ps);
size_t [mbrtoc8](#lib:mbrtoc8 "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(char8_t* pc8, const char* s, size_t n, mbstate_t* ps);
size_t [c8rtomb](#lib:c8rtomb "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(char* s, char8_t c8, mbstate_t* ps);
size_t [mbrtoc16](#lib:mbrtoc16 "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(char16_t* pc16, const char* s, size_t n, mbstate_t* ps);
size_t [c16rtomb](#lib:c16rtomb "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(char* s, char16_t c16, mbstate_t* ps);
size_t [mbrtoc32](#lib:mbrtoc32 "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(char32_t* pc32, const char* s, size_t n, mbstate_t* ps);
size_t [c32rtomb](#lib:c32rtomb "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(char* s, char32_t c32, mbstate_t* ps);
size_t [mbsrtowcs](#lib:mbsrtowcs "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(wchar_t* dst, const char** src, size_t len, mbstate_t* ps);
size_t [wcsrtombs](#lib:wcsrtombs "28.7.5Multibyte / wide string and character conversion functions[c.mb.wcs]")(char* dst, const wchar_t** src, size_t len, mbstate_t* ps);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L13358)
*Effects*: These functions have the semantics specified in the C standard library[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L13362)
*Remarks*: Calling these functions
with an mbstate_t* argument that is a null pointer value
may introduce a data race ([[res.on.data.races]](res.on.data.races "16.4.6.10Data race avoidance"))
with other calls to the same function
with an mbstate_t* argument that is a null pointer value[.](#6.sentence-1)
See also: ISO/IEC 9899:2024, 7.30.1, 7.31.6.3, 7.31.6.4