Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!aries!mcdonald From: mcdonald@aries.scs.uiuc.edu (Doug McDonald) Newsgroups: comp.lang.c Subject: Re: NOT Educating FORTRAN programmers to use C Message-ID: <1990Jan23.151533.7009@ux1.cso.uiuc.edu> Date: 23 Jan 90 15:15:33 GMT References: <7536@chaph.usc.edu> <14201@lambda.UUCP> Sender: news@ux1.cso.uiuc.edu (News) Distribution: na Organization: Univ. of Illinois at Urbana-Champaign, Chemical Sciences Lines: 15 >> [...] >> src = str2; >> while (*src && remaining) { >> *dst++ = *src++; >> remaining--; >> } Assuming that it is known that remaining is less than the allocation of either src or dst, then one could save the character at (src + remaining), replace it with zero, copy until zero was hit, and then fix up the marker byte. You provide the code and the exact place to put the marker byte. This takes only one loop with only one test. Doug McDonald