名前空間
変種
操作

std::memset

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

 
 
ストリングスライブラリ
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.
strcpy
strncpy
strcat
strncat
strxfrm
文字列の検査
Original:
String examination
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
メモリ操作
Original:
Memory manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
memchr
memcmp
memset
memcpy
memmove
その他
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strerror
 
Defined in header <cstring>
void* memset( void* dest, int ch, std::size_t count );
chに値を変換してunsigned charcountが指すオブジェクトの最初のdest文字のそれぞれにそれをコピーします。オブジェクト(例えば、スカラー、配列、またはC互換の構造体)-自明コピー可能でない場合、動作は未定義です。 countdestが指すオブジェクトのサイズよりも大きい場合、動作は未定義です.
Original:
Converts the value ch to unsigned char and copies it into each of the first count characters of the object pointed to by dest. If the object is not trivially-copyable (e.g., scalar, array, or a C-compatible struct), the behavior is undefined. If count is greater than the size of the object pointed to by dest, 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 object to fill
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ch -
バイトを埋める
Original:
fill byte
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
count -
埋めるためにバイト数
Original:
number of bytes to fill
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

dest

[編集]

#include <iostream>
#include <cstring>
 
int main()
{
    int a[20];
    std::memset(a, 0, sizeof(a));
    std::cout << "a[0] = " << a[0] << '\n';
}

Output:

a[0] = 0

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

別のバッファにコピーします
Original:
copies one buffer 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]
要素の数に値を代入します
Original:
assigns a value to a number of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート) [edit]
checks if a type is trivially copyable
(クラステンプレート) [edit]
C documentation for memset