Thank Chaps! I went with the string function, perl seemed a bit of a long way round though I'm sure educational
I used
int s1;
char *p,*name;
int loop=0;
char *n="text.txt"; /*test*/
p=strrchr(filename,'/'); /*get final / put error here for null*/
s1=strlen((filename)-strlen(p))+1;
name=malloc(s1);
memcpy (name, filename, s1);
printf(" %d\n",s1); /*view results*/
printf(" %s \n",name);
strcat(name,n);
printf(" %s \n",name);
Wouldn't you think C would have a function for this?