Namensräume
Varianten
Aktionen

std::wcsncpy

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

 
 
Strings Bibliothek
Null-terminierte Strings
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.
Byte-Strings
Multibyte-Strings
Wide Strings
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.
basic_string
char_traits
 
Nullterminierten Wide Strings
Funktionen
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Character Manipulation
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.
Umwandlungen in numerische Formate
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.
String-Manipulation
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.
Array-Manipulation
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
 
definiert in Header <cwchar>
wchar_t *wcsncpy( wchar_t *dest, const wchar_t *src, std::size_t count );
Kopien in den meisten count Zeichen des großen String, auf den src (einschließlich des abschließenden null-Zeichen) an Wide-Character Array, auf das 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.
Wenn count erreicht wird, bevor der gesamte String src kopiert wurde, ist die resultierende breite Zeichenarray nicht null-terminierte .
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.
Wenn Sie nach dem Kopieren der abschließenden Null-Zeichen aus src, count nicht erreicht ist, werden zusätzliche null breite Zeichen dest geschrieben, bis die Summe der count Zeichen geschrieben wurden .
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.
Wenn die Saiten überlappen, ist das Verhalten undefiniert .
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.

Inhaltsverzeichnis

[Bearbeiten] Parameter

dest -
Zeiger auf den Wide-Character-Array zu kopieren
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 -
Zeiger auf die breite String aus kopieren
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 -
maximale Anzahl von breiten Zeichen zu kopieren
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.

[Bearbeiten] Rückgabewert

dest

[Bearbeiten] Notes

In der typischen Anwendung ist count die Größe des Ziel-Array .
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.

[Bearbeiten] Beispiel

#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

[Bearbeiten] Siehe auch

kopiert ein breites String an einen anderen
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.

(Funktion) [edit]
kopiert eine gewisse breiten Zeichen zwischen zwei nichtüberlappenden Arrays
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.

(Funktion) [edit]
C documentation for wcsncpy