The easiest way is to start from the back of the string and search for the "\\". This is easy. Once you have the pointer you can display the file name.
int len = strlen(fname);
int pos = len - 1;
char* name = NULL;
while (pos >= 0)
{
if (fname[pos] == '\\')
{
pos++;
name = fname + pos;
printf("fname=%s\n", name);
}
pos--;
}