int main()
{
FILE *temp,*list;
char *line,*tem;
system("color f3");
system("mode con: cols=120 lines=40");
system("dir /s /b /a:-h >>$$temp");
temp=fopen("$$temp","r");
if(temp==NULL)
{
printf("Cann't creat temp file./n");
return 0;
}
list=fopen("play_list.ch","wb");
if(list==NULL)
{
printf("Cann't creat list file./n");
return 0;
}
line=(char *)calloc(1,MaxLenth*sizeof(char));
while((fgets(line,MaxLenth,temp))!=NULL&&line!=NULL)
{
line[strlen(line)-1]=0x00;
puts(line);
tem=line+2;
if(CheckFormat(line,".mp3")==1||CheckFormat(line,".wma")==1||CheckFormat(line,".MP3")==1||CheckFormat(line,".WMA")==1)
{
FileNum++;
while(*tem&&*tem!=0x0d)
{
if(*tem==0x5c)
*tem=0x2f;
fprintf(list,"%c",*tem++);
}
fprintf(list,"%c",0x0a);
//fprintf(list,"%s%c",line+2,0x0a);
}
free(line);
line=(char *)calloc(1,MaxLenth*sizeof(char));
}
fclose(list);
fclose(temp);
printf("一共找到%d首歌曲/n谢谢使用,即将自动关闭……",FileNum);
Sleep(4000);
system("del $$temp");
return 0;
}