Simple solution found on google: http://www.linuxquestions.org/questions/programming-9/replace-a-substring-with-another-string-in-c-170076/
Edit: Taking your specification into account, I've edited the code in the link to this:
char *replace_str(char *str, char *orig, char *rep, int start)
{
static char temp[4096];
static char buffer[4096];
char *p;
strcpy(temp, str + start);
if(!(p = strstr(temp, orig))) // Is 'orig' even in 'temp'?
return temp;
strncpy(buffer, temp, p-temp); // Copy characters from 'temp' start to 'orig' str
buffer[p-temp] = '\0';
sprintf(buffer + (p - temp), "%s%s", rep, p + strlen(orig));
sprintf(str + start, "%s", buffer);
return str;
}