原子老大 能否抽空解释一下下面这个函数是怎么实现其功能的? 实在是看不懂!!
/*输入:exName文件扩展名 返回扩展名类型*/
/*返回值:文件的类型,目前支持20种文件类型,最大支持32种文件类型 */
u32 FileType_Tell(u8 * exName)
{
u8 i;
u8 t;
for(i=0;i<20;i++)
{
for(t=0;t<3;t++)if(exName[t]!=filetype[t])break;
if(t==3)break;
}
return 1<<i; //返回文件类型
}
与它相关的数组为
/*文件类型 3gp,3g2,m4a,mp4也是支持的.返回值:对应的类型*/
/*0,mp1;1,mp2;2,mp3;3,mp4;4,m4a;5,3gp;6,3g2;7,ogg;8,acc;9,wma;10,wav;11,midi;12,flac;*/
/*13,lrc;14,txt;15,c;16,h;17,file;18,FON;19,SYS;20,bmp;21,jpg;22,jpeg; */
const unsigned char *filetype[23]=
{
"MP1","MP2","MP3","MP4","M4A","3GP","3G2","OGG","ACC","WMA","WAV","MID","FLA",
"LRC","TXT","C ","H "," ","FON","SYS","BMP","JPG","JPE"
};
|