名前空間
変種
操作

std::wcsncpy

提供: cppreference.com
< cpp‎ | string‎ | wide

 
 
ストリングスライブラリ
NULLで終わる文字列
Original:
Null-terminated strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
バイト文字列
文字列をマルチバイト
ワイド文字列
クラス
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string
char_traits
 
nullで終了するワイド文字列
機能します
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
文字操作
Original:
Character manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
数値形式への変換
Original:
Conversions to numeric formats
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
文字列操作
Original:
String manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
配列操作
Original:
Array manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
wmemcpy
wmemmove
wmemcmp
wmemchr
wmemset
 
Defined in header <cwchar>
wchar_t *wcsncpy( wchar_t *dest, const wchar_t *src, std::size_t count );
ワイド文字配列へcountが指すワイド文字列の中で最もsrc文字(終端のnullワイド文字を含む)でのコピーがdestによって指さ.
Original:
Copies at most count characters of the wide string pointed to by src (including the terminating null wide character) to wide character array pointed to by dest.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
文字列全体のcountがコピーされた前srcに達した場合は、結果のワイド文字配列は、NULL終端ではない.
Original:
If count is reached before the entire string src was copied, the resulting wide character array is not null-terminated.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
srcから終端のnullワイド文字をコピーした後、countに達していない場合、dest文字の合計が書き込まれるまで、追加のNULLワイド文字はcountに書き込まれます。.
Original:
If, after copying the terminating null wide character from src, count is not reached, additional null wide characters are written to dest until the total of count characters have been written.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
文字列が重複している場合は、動作は未定義です.
Original:
If the strings overlap, the behavior is undefined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

dest -
にコピーするワイド文字の配列へのポインタ
Original:
pointer to the wide character array to copy to
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
src -
からコピーするワイド文字列へのポインタ
Original:
pointer to the wide string to copy from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
count -
コピーするワイド文字の最大数
Original:
maximum number of wide characters to copy
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

dest

[編集] ノート

典型的な使い方では、countは、コピー先の配列のサイズです。.
Original:
In typical usage, count is the size of the destination array.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

#include <iostream>
#include <cwchar>
 
int main()
{
    wchar_t src[] = L"hi";
    wchar_t dest[6] = {L'a', L'b', L'c', L'd', L'e', L'f'};;
 
    std::wcsncpy(dest, src, 5); // this will copy hi and repeat \0 three times
 
    std::wcout << "The contents of dest are: ";
    for(wchar_t c : dest) {
        if(c)
            std::wcout << c << ' ';
        else
            std::wcout << "\\0" << ' ';
    }
    std::wcout << '\n';
}

Output:

The contents of dest are: h i \0 \0 \0 f

[編集] も参照してください

別のワイド文字列をコピーします
Original:
copies one wide string to another
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数) [edit]
2つの非重複配列の間のワイド文字の一定量をコピーします
Original:
copies a certain amount of wide characters between two non-overlapping arrays
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数) [edit]
C documentation for wcsncpy