- cwchar[meta header]
- std[meta namespace]
- function[meta id-type]
namespace std {
wchar_t* wcsncat(wchar_t* s1, const wchar_t* s2, size_t n);
}- size_t[link /reference/cstddef/size_t.md]
文字数を指定して、ワイド文字列を連結する。
s1が指す文字列の末尾へ、s2が指す文字列から最大n文字を連結する。連結後の末尾には、必ずヌル文字が書き込まれる。
s1を返す。
- 連結先の領域は、連結後の文字列と終端のヌル文字を格納できる大きさでなければならない
- この関数は、C++26からフリースタンディング処理系でも使用できる
#include <cwchar>
#include <iostream>
int main()
{
wchar_t buffer[16] = L"hello";
std::wcsncat(buffer, L" world", 3);
std::wcout << buffer << std::endl;
}- std::wcsncat[color ff0000]
- std::wcout[link /reference/iostream/wcout.md]
hello wo
- C++98
wcscatstd::strncat(): マルチバイト文字列版
- P2338R4 Freestanding Library: Character primitives and the C library
- C++26で、この関数がフリースタンディング処理系で使用可能になった