Espacios de nombres
Variantes
Acciones

Diferencia entre revisiones de «cpp/string/byte/memset»

De cppreference.com
< cpp‎ | string‎ | byte
m (r2.7.3) (Bot Añadido: de, en, it, ru Eliminado: es)
m (Use {{lc}}. Update links. Various fixes.)
 
Línea 9: Línea 9:
  
 
===Parámetros===
 
===Parámetros===
{{param list begin}}
+
{{begin}}
{{param list item | dest |{{tr| puntero al objeto de llenar| pointer to the object to fill}}}}
+
{{| dest |{{tr| puntero al objeto de llenar| pointer to the object to fill}}}}
{{param list item | ch |{{tr| llenar byte| fill byte}}}}
+
{{| ch |{{tr| llenar byte| fill byte}}}}
{{param list item | count |{{tr| número de bytes que llenar| number of bytes to fill}}}}
+
{{| count |{{tr| número de bytes que llenar| number of bytes to fill}}}}
{{param list end}}
+
{{end}}
  
 
===Valor de retorno===
 
===Valor de retorno===
Línea 35: Línea 35:
  
 
===Ver también===
 
===Ver también===
{{dcl list begin}}
+
{{begin}}
{{dcl list template | cpp/string/byte/dcl list memcpy}}
+
{{| cpp/string/byte/memcpy}}
{{dcl list template | cpp/algorithm/dcl list fill_n}}
+
{{| cpp/algorithm/fill_n}}
{{dcl list template | cpp/types/dcl list is_trivially_copyable}}
+
{{| cpp/types/is_trivially_copyable}}
{{dcl list see c | c/string/byte/memset}}
+
{{see c | c/string/byte/memset}}
{{dcl list end}}
+
{{end}}
  
 
[[de:cpp/string/byte/memset]]
 
[[de:cpp/string/byte/memset]]

Última revisión de 00:19 2 jul 2013

 
 
 
Cadenas de bytes terminadas en nulo
Funciones
Manipulación de caracteres
Conversiones a formatos numéricos
(C++11)(C++11)
(C++11)(C++11)
Manipulación de cadenas
Examinación de cadenas
Manipulación de memoria
memset
Misceláneos
 
Definido en el archivo de encabezado <cstring>
void* memset( void* dest, int ch, std::size_t count );
Convierte el valor a ch unsigned char y lo copia en cada uno de los personajes count primera del objeto apuntado por dest. Si el objeto no es trivial-copiable (por ejemplo, escalar, matriz o una estructura C-compatible), el comportamiento no está definido. Si count es mayor que el tamaño del objeto apuntado por dest, el comportamiento es 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.

Contenido

[editar] Parámetros

dest -
puntero al objeto de llenar
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 -
llenar 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 que llenar
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] Ejemplo

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

Salida:

a[0] = 0

[editar] Ver también

Copia un búfer a otro
(función) [editar]
Asigna por copia el valor dado a todos los elementos de un rango.
(plantilla de función) [editar]
Comprueba si un tipo es trivialmente copiable.
(plantilla de clase) [editar]