From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) Newsgroups: comp.os.msdos.djgpp Subject: Re: Help with strings MID$? Date: 29 Aug 1997 08:35:13 GMT Organization: The National Capital FreeNet Lines: 29 Message-ID: <5u61k1$9a5@freenet-news.carleton.ca> References: <01bcb3ea$4e6e4560$6889d2cd AT inventor DOT worldchat DOT com> <340626E7 DOT 47A7682F AT alcyone DOT com> Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) NNTP-Posting-Host: freenet2.carleton.ca To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Erik Max Francis (max AT alcyone DOT com) writes: > Vincent Collura wrote: > >> For those who dont know, mid$ returns the >> n'th character to the nth number. >> >> What is the C++ function to do this? I have >> tried StrnCat but the problem with this is you >> cant specificy a starting location. > > There isn't a standard C function do to this for you. You're going to > have to write your own. void strncatat(char *dest, char *src, int startchr, int max) { // Startchr is from 1 on upwards int s2; char *temp; s2=startchr-1; if (s2<0) s2=0; // Or it could print a message and die, or something. temp=src+s2; // Character startchr of src. strncat(dest,temp,max); } -- .*. Where feelings are concerned, answers are rarely simple [GeneDeWeese] -() < When I go to the theater, I always go straight to the "bag and mix" `*' bulk candy section...because variety is the spice of life... [me] Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh