Mail Archives: djgpp/1997/08/29/04:18:36
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
- Raw text -