Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.41 KB

wcsncat.md

File metadata and controls

63 lines (45 loc) · 1.41 KB

wcsncat

  • 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

関連項目

参照