From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) Newsgroups: comp.os.msdos.djgpp Subject: Re: Help with strings MID$? Date: 30 Aug 1997 05:20:08 GMT Organization: The National Capital FreeNet Lines: 21 Message-ID: <5u8ai8$22o@freenet-news.carleton.ca> References: Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) NNTP-Posting-Host: freenet3.carleton.ca To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Orlando Andico (orly AT gibson DOT eee DOT upd DOT edu DOT ph) writes: > 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!! Or, leave mystring[7] alone and use strncpy or strncat with 'n' equal to 3. (And you meant mystring + 4 right? mystring + 0 is the first char, + 4 is the fifth.) -- .*. 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