namespace std {
wchar_t* wcsncat(wchar_t* s1, const wchar_t* s2, size_t n);
}
概要
文字数を指定して、ワイド文字列を連結する。
効果
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;
}
出力
hello wo
バージョン
言語
- C++98
関連項目
wcscatstd::strncat(): マルチバイト文字列版
参照
- P2338R4 Freestanding Library: Character primitives and the C library
- C++26で、この関数がフリースタンディング処理系で使用可能になった