std::wcsncpy — cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Déclaré dans l'en-tête <cwchar> |
||
|
|
||
Des copies de la plupart des personnages count de la chaîne pointée par gamme src (y compris le caractère nul final) au tableau de caractères larges pointée par 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 est atteint avant la src chaîne entière a été copié, le tableau de caractères large en résultant n'est pas terminée par NULL .
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, après avoir copié le caractère nul final de src, count n'est pas atteint, d'autres caractères larges nuls sont écrites dest jusqu'à ce que le total de caractères count ont été écrit .
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 les cordes se chevauchent, le comportement est indéfini .
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.
Paramètres
| dest | - | pointeur vers le tableau de caractères larges de la copie Original: pointer to the wide character array to copy to The text has been machine-translated via Google Translate. |
| src | - | pointeur vers la chaîne de gamme à copier Original: pointer to the wide string to copy from The text has been machine-translated via Google Translate. |
| count | - | nombre maximum de caractères larges à copier Original: maximum number of wide characters to copy The text has been machine-translated via Google Translate. |
Retourne la valeur
dest
Notes
En utilisation normale, count est la taille du tableau de destination .
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.
Exemple
#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'; }
Résultat :
The contents of dest are: h i \0 \0 \0 f
Voir aussi
copie une chaîne large à l'autre Original: copies one wide string to another The text has been machine-translated via Google Translate. (fonction) [edit] | |
copie d'un certain nombre de caractères larges entre deux rangées ne se chevauchent pas Original: copies a certain amount of wide characters between two non-overlapping arrays The text has been machine-translated via Google Translate. (fonction) [edit] | |
C documentation for wcsncpy | |