获取文件名函数:
int retName (char* fName ,char * ret, int * retSize)
{
char * prtS = NULL;
char * prtL = NULL;
prtS = fName;
prtL = fName;
int length = strlen(fName);
int count = 0;
for(int i = 0; i < length; i ++)
{
if(*prtS == '\\')
{
count ++;
}
prtS ++;
}
printf("count = %d\n", count);
prtS = fileName;
prtL = fileName;
int num = 0;
while(1)
{
prtS = strstr(prtS, "\\");
num ++;
prtS ++;
if(num == count)
{
break;
}
}
prtL = strstr(prtS, ".");
* prtL = '\0';
printf("res1 = %s\n",prtL);
printf("res2 = %s\n",prtS);
memcpy(ret, prtS, (prtL - prtS + 1));
* retSize = prtL - prtS;
return 0;
}