std::wcsncpy
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <cwchar>
|
||
wchar_t *wcsncpy( wchar_t *dest, const wchar_t *src, std::size_t count ); |
||
Copie a personaggi più
count
della stringa puntata da ampia src
(incluso il carattere nullo di terminazione grandangolo) a matrice di caratteri gamma puntato da 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.
You can help to correct and verify the translation. Click here for instructions.
Se
count
viene raggiunto prima della src
intera stringa è stata copiata, la matrice risultante di caratteri estesi non è null-terminated.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.
You can help to correct and verify the translation. Click here for instructions.
Se, dopo aver copiato il carattere nullo di terminazione larga da
src
, count
non viene raggiunto, ulteriori caratteri null larghi vengono scritti dest
fino al totale di caratteri count
sono stati scritti.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.
You can help to correct and verify the translation. Click here for instructions.
Se le stringhe si sovrappongono, il comportamento non è definito.
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.
You can help to correct and verify the translation. Click here for instructions.
Indice |
[modifica] Parametri
dest | - | puntatore alla matrice di caratteri estesi in cui copiare
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 | - | puntatore alla stringa ampia da cui copiare
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 | - | il numero massimo di caratteri larghi da copiare
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. |
[modifica] Valore di ritorno
dest
[modifica] Note
Nell'uso tipico,
count
è la dimensione della matrice di destinazione.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.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Esempio
#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
[modifica] Vedi anche
copia una stringa larga ad un altro 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. (funzione) | |
copia un certo numero di caratteri estesi tra due matrici non si sovrappongono 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. (funzione) | |
C documentation for wcsncpy
|