TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Frank Adam
from: Paul Edwards
date: 1995-09-12 08:37:48
subject: Re: chngstr.c

FA>  Funny,i was just working on the same thing.The problem with my and your
FA>  example is that it will replace the occurance of that string even if
FA>  it's part of a word, E.g: Searching for "Tom" and
replacing it with "John"
FA>  would make "Tomcat" "Johncat".Any ideas ? Even
searching for " Tom " would
FA>  not fix it as if Tom happens to be the first or last word it would remain
FA>  unchanged.

Other than writing the code, no.

FA> #include
FA> #include


FA> #include
FA> #include

What's this crap included for?  It makes your program non-ISO.

FA> char* searchstr(char *str,char *search,char *replace)
FA> {
FA>  if(!*str) return NULL;
FA>  if(*search && *replace)
FA>  {
FA>   char *parts,*strtemp; // as in 'parts' of the string.

'//' are not valid C comments.

FA> Anyway for what it's worth this is mine.I'm only about a year old:) so
FA> gimme a break.This will actually replace all occurances.Can you spot any
FA> flows with it?

Only the above.  BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.