Date: Fri, 29 Aug 1997 16:16:49 +0800 (GMT) From: Orlando Andico To: Erik Max Francis cc: djgpp AT delorie DOT com Subject: Re: Help with strings MID$? In-Reply-To: <340626E7.47A7682F@alcyone.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Thu, 28 Aug 1997, Erik Max Francis wrote: > 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. .. Ack. I remember when I graduated from Basic to C, I was so pissed off because there was no mid$/left$/right$ and so forth. until i discovered The Joy of Pointers (tm) :) char *mystring="1234567890"; char *mid3; to get characters 5..7 (destructively though) mystring[7] = '\0'; /* chop off 8th character and rest */ mid3 = mystring + 5; /* point to fifth character */ and you're there!! ------------------------------------------------------------------- Orlando Alcantara Andico WWW: http://www2.mozcom.com/~orly/ Email: orly AT mozcom DOT com ICBM: 14 30 00 N 120 59 00 E POTS: (+632) 932-2385