This is an example of one way to insert a string of char's, into the middle of another string.
I believe this is what you want:
Code:
#include <stdio.h>
#include <string.h>
int shift(char *dest, char *src, int len_dest, int len_src, int size);
int main(void)
{
size_t size;
int len_dest, len_src, ip;
//dest[] must be oversized to handle it's current char's + the char's
//that will be inserted.
char dest[68] = "abcdefghijklmnopqrstuvwxyz0123456789";
char *src = "******************************";
len_dest = strlen(dest);
len_src = strlen(src);
size = sizeof(dest);
printf("\n\n\ndestination prior to memmove:\n%s", dest);
ip = shift(dest, src, len_dest, len_src, size);
memmove(dest+ip, src, len_src);
printf("\ndestination after memmove:\n%s", dest);
ip=getchar();
return 0;
}
int shift(char *dest, char *src, int len_dest, int len_src, int size) {
int i, j, ipoint;
char *iptr;
if(size < (len_dest + len_src))
printf("\n Destination buffer is too small");
else {
//find the insertion point:
iptr = strstr(dest, "defghij"); //
ipoint = iptr-dest;
//shift the char's after the insertion point
for(i=len_dest,j=len_dest+len_src;i>=ipoint;i--, j--) {
dest[j] = dest[i];
}
/*After the shift, the string may not view correctly, until after
the memmove(). Shifted letters may not appear. They are there ;)
*/
}
return ipoint;
}