Hi!
> (1) (die wichtige)
> Ich will unter FreeBSD die C-Funktion "strcat" nutzen, allerdings gibt
> mir schon das folgende stückchen code einen bus error ("exited on
> signal 10"):
>
> #include <string.h>
> #include <stdio.h>
> main() {
> char* s = "Hello";
> const char* t = " World";
> s = strcat( s, t );
> printf("%s\n", s);
> return 0;
> }
Aus der Manpage:
The strcat() and strncat() functions append a copy of the null-terminated
string append to the end of the null-terminated string s, then add a ter-
minating `\0'. The string s must have sufficient space to hold the re-
sult. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^
char s[12] = "Hello";
und so weiter sollte gehen.
Ausserdem ist der Speicherbereich unter dem "Hello" abgelegt wird
bei Deiner Varaiante nicht notwendigerweise ueberhaupt schreibbar,
bin jetzt aber zu faul rauszukramen, wie gcc unter BSD das macht.
Gruss,
Patrick
To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Tue 27 Jul 1999 - 22:44:28 CEST