#include "FM_CheckFile.h"
int FM_CheckFile()
{
FILE *fp = NULL; //定义用于文件操作的指针
char *s = (char *)malloc(sizeof(char)*100); //定义文件路径字符串
int no = 0; //定义歌曲编号
HANDLE hfind; //声明用于操作寻找到的文件的句柄
WIN32_FIND_DATA ffbuf; //声明存放磁盘文件信息的结构体
hfind = FindFirstFile("D:\\*.mp3", &ffbuf); //寻找磁盘中第一个符合条件的文件
sprintf(s,"D:\\%s",ffbuf.cFileName); //整合字符串和歌曲名变量为一个字符串s
fp = fopen(s,"r"); //打开文件
fseek(fp,-128,SEEK_END); //读取文件倒数128个字节(文件信息)
fread(info[no].tag,sizeof(char),3,fp);
fread(info[no].song,sizeof(char),30,fp);
fread(info[no].singer,sizeof(char),30,fp);
strcpy(info[no].add,s);
info[no].ID = no+1;
while(FindNextFile(hfind,&ffbuf))
{
sprintf(s,"D:\\%s",ffbuf.cFileName);
fp = fopen(s,"r");
if (fp==NULL) //加上当前目录
{
// printf("Open File Error !\r\n");
}
else
{
no++;
fseek(fp,-128,SEEK_END);
fread(info[no].tag,sizeof(char),3,fp);
fread(info[no].song,sizeof(char),30,fp);
fread(info[no].singer,sizeof(char),30,fp);
strcpy(info[no].add,s);
info[no].ID = no+1;
}
}
return no+1;
}
void FM_CheckFilePrint(int m,int d)
{
int i;
for(i=m;i!=d;i++)
{
printf(" %3d ",info[i].ID);
printf(" %-20s ",info[i].song);
printf(" %-10s\n",info[i].singer);
}
printf(" -------------------------------------------------------\n");
}
x1204192032
- 粉丝: 1
- 资源: 1
最新资源
- bimdata_api_client-1.3.3-py3-none-any.whl
- bimdata_api_client-2.0.1-py3-none-any.whl
- bimdata_api_client-2.0.0-py3-none-any.whl
- bimdata_api_client-2.1.0-py3-none-any.whl
- bimdata_api_client-2.3.0-py3-none-any.whl
- bimdata_api_client-2.2.0-py3-none-any.whl
- bimdata_api_client-2.3.1-py3-none-any.whl
- bimdata_api_client-2.4.0-py3-none-any.whl
- bimdata_api_client-2.5.0-py3-none-any.whl
- bimdata_api_client-2.5.3-py3-none-any.whl
- bimdata_api_client-2.5.2-py3-none-any.whl
- bimdata_api_client-2.5.1-py3-none-any.whl
- bimdata_api_client-2.5.4-py3-none-any.whl
- bimdata_api_client-2.6.0-py3-none-any.whl
- bimdata_api_client-2.7.0-py3-none-any.whl
- bimdata_api_client-2.8.0-py3-none-any.whl
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
前往页