I am working with a program that needs to trim the path name down to just the filename. I am using windows. This input is coming from a predetermined value in the registry. I was wondering what the best method of doing this would be.
The method that I think would be the easiest would be this way:
Code:
char sTemp[1024];
char newTitle[1024];
//This approaches the first back slash from the right side of the string
for (i = strlen(sTemp); i > 0; i--)
if (sTemp[i-1] == '\\')
{
strcpy(newTitle, sTemp[i-1]);
break;
}
Unfortunately I get:
Error 1 error C2664: 'strcpy' : cannot convert parameter 2 from 'char' to 'const char *
This seems to be a good way to do it, but apparently I am confusing on what format to send my arguments to strcpy. Or maybe I should be using an entirely different function.