Strcpy fun w/ Ultrix
tim at scsmo1.UUCP
tim at scsmo1.UUCP
Fri Apr 28 01:32:00 AEST 1989
I ran accross a problem with strcpy in ultrix, for some reason it will
not return its first argument. This is something like the "buged" code:
x->name=strcpy(malloc(strlen(in)+1),in);
The solution was:
strcpy(x->name=malloc(strlen(in)+1),in);
I was under the impression that strcpy will copy its first argument and
it does most of the time. I have never run into this problem before, is
it common? The thing that strcpy was returing was in a different section
of prevously malloc'ed memory and the strings do not overlap.
tim hogard
uunet!worlds!gensis!hogard /* new address */
"Ultrix will drive you to drink!"
More information about the Comp.lang.c
mailing list