Strcpy fun w/ Ultrix
Robert Steven Glickstein
bobg+ at andrew.cmu.edu
Tue May 2 07:22:28 AEST 1989
> Excerpts from ext.nn.comp.lang.c: 27-Apr-89 Strcpy fun w/ Ultrix
> tim at scsmo1.UUCP (618)
> 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);
Danger, Will Robinson! Bad programming style alert!
Do you WANT to dump core if malloc returns NULL?
-Bob Glickstein
More information about the Comp.lang.c
mailing list