Espaços nominais
Variantes
Acções

std::memset

Da cppreference.com
< cpp‎ | string‎ | byte

 
 
Biblioteca cordas
Strings terminadas
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.
Cadeias de bytes
Multibyte cordas
Cordas de largura
Classes
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
Cordas de terminação nula de bytes
Funções
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Manipulação personagem
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.
Conversões para formatos numéricos
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.
Manipulação de cadeia
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.
Exame String
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.
Manipulação de memória
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.
memset
Diversos
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
Definido no cabeçalho <cstring>
void* memset( void* dest, int ch, std::size_t count );
Converte o valor para ch unsigned char e copia-lo em cada um dos personagens count primeira do objeto apontado por dest. Se o objeto não é trivialmente-copiável (por exemplo, escalar, matriz, ou uma estrutura compatível com C), o comportamento é indefinido. Se count é maior do que o tamanho do objeto apontado por dest, o comportamento é indefinido.
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.

Índice

[editar] Parâmetros

dest -
ponteiro para o objeto para preencher
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 -
encher byte
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 -
número de bytes para preencher
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.

[editar] Valor de retorno

dest

[editar] Exemplo

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

Saída:

a[0] = 0

[editar] Veja também

copia um buffer para outro
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.

(função) [edit]
atribui um valor a um certo número de elementos
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.

(modelo de função) [edit]
checks if a type is trivially copyable
(modelo de classe) [edit]
Documentação C para memset