Char-Pointer
-
strcpy() (oder noch besser: strncpy(), damit kannst du die maximale Größe angeben)
-
Am besten du nimmst memcpy. strcpy ist unsicher und strncpy ist sehr sehr merkwürdig.
-
Warum sollte strncpy merkwürdig sein

Beim memcpy nicht vergessen ein Byte mehr zu kopieren, sonst fehlt das Nullbyte.
-
msdn schrieb:
The strncpy function copies the initial count characters of strSource to strDest and returns strDest. If count is less than or equal to the length of strSource, a null character is not appended automatically to the copied string.
Deswegen kann man es auch gleich mit memcpy machen.
-
thx for help nun ne andere Frage wie kann ich Zeichen aus einem char-Array addiert in einen string array schreiben?
Beispiel: char-Array: ['a','b','c'] in String-Array: ["abc"] ?
-
Was genau meinst du mit string-Array?
Ich denke mal nichtstd::string foo[42];oder?
-
doch ich meinte vector <string> foo.
-
mit
foo.push_back(string("Hallo"));
-
Nein das geht glaube nicht...is mach nen neuen Thread auf und erkläre es nochmal bzw. besser.
-
Hier geht es weiter:
http://www.c-plusplus.net/forum/viewtopic-var-t-is-136923.html