Path: utzoo!attcan!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!uc!nic.MR.NET!thor.acc.stolaf.edu!mike From: mike@thor.acc.stolaf.edu (Mike Haertel) Newsgroups: comp.lang.c Subject: I am an Idiot Message-ID: <4950@thor.acc.stolaf.edu> Date: 25 Aug 89 05:25:05 GMT Organization: St. Olaf College; Northfield, MN Lines: 22 In some article or another @thor.stolaf.edu, I asserted that the following: char * strcpy(char *s, const char *t) /* NOT REALLY!!! */ { char *r = s, c; while (c = *t++) *s++ = c; return r; } was an implementation of strcpy that wouldn't compute &c + 1 given arguments strcpy(&c, ""). True. However, it also would not copy the final NUL byte of the source string. THus, the subject: line on this message. Insert "*s = c;" before the return statement. -- Mike Haertel ``There's nothing remarkable about it. All one has to do is hit the right keys at the right time and the instrument plays itself.'' -- J. S. Bach