Espacios de nombres
Variantes
Acciones

std::wcsncpy

De cppreference.com
< cpp‎ | string‎ | wide

 
 
Strings biblioteca
Terminadas en nulo
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.
Cadenas de bytes
Multibyte cuerdas
Cadenas anchas
Clases
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
 
Terminadas en nulo de ancho
Funciones
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
De manipulación de caracteres
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.
Las conversiones a 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.
Cadena de manipulación
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.
Matriz de manipulación
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 );
Las copias de la mayoría de los caracteres de la cadena count gama apuntada por src (incluyendo el carácter ancho terminador nulo) a la matriz de caracteres anchos apuntada por 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.
Si count se alcanza antes de la src cadena entera se ha copiado, la matriz resultante carácter ancho no es terminada en cero .
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.
Si después de copiar el carácter ancho terminador nulo de src, count no se alcanza, otros caracteres anchos nulos se escriben en dest hasta que el total de caracteres count se han escrito .
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.
Si las cadenas se superponen, el comportamiento no está definido .
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.

Contenido

[editar] Parámetros

dest -
puntero al array de caracteres anchos a copiar
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 -
puntero a la cadena ancha para copiar
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 -
número máximo de caracteres anchos a copiar
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.

[editar] Valor de retorno

dest

[editar] Notas

En el uso típico, count es el tamaño de la matriz de destino .
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.

[editar] Ejemplo

#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

[editar] Ver también

copia una cadena ancha a otro
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.

(función) [edit]
copia una cierta cantidad de caracteres anchos entre dos matrices que no se solapan
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.

(función) [edit]
C documentation for wcsncpy