u8 res;
u8 *fn; /* This function is assuming non-Unicode cfg. */
#if _USE_LFN
fileinfo.lfsize = _MAX_LFN * 2 + 1;
fileinfo.lfname = mymalloc(SRAMIN,fileinfo.lfsize);
#endif
res = f_opendir(&dir,(const TCHAR*)path);
if (res == FR_OK)
{
while(1)
{
res = f_readdir(&dir, &fileinfo);
if (res != FR_OK || fileinfo.fname[0] == 0) break;
#if _USE_LFN
fn =(u8*)( *fileinfo.lfname ? fileinfo.lfname : fileinfo.fname);
#else
fn =(u8*)( fileinfo.fname);
#endif
printf("1%s
", fn);
printf("2%s
", fileinfo.lfname);
printf("3%s
", fileinfo.fname);
}
}
myfree(SRAMIN,fileinfo.lfname);
测试上面测程序,测试结果如下;读出SD卡根目录发现英文文件名的可以读出长文件名和短文件名,但是带中文文件名的就不能读出长文件名,这是怎么回事呢??大家帮忙看看
1System Volume Information
2System Volume Information
3SYSTEM~1
1yusan.zxep
2yusan.zxep
3YUSAN~1.ZXE
1WUSHI_1.75_JS_SWG1.zxep
2WUSHI_1.75_JS_SWG1.zxep
3WUSHI_~1.ZXE
1蜗牛17~1.TXT
2
3蜗牛17~1.TXT
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>