#include<iostream.h>
#include<stdlib.h>
#include<windows.h>
#include <mmsystem.h>
#include<string>
#include<time.h>
#include<fstream.h>
#include<stdio.h>
#pragma comment (lib, "winmm.lib")
class Mp3file
小宇宙歌词{
friend class Mp3list;
public:
private:
char TAG[3];//标签
刘晓棕有几段婚史 char title[30];//歌名
char artlist[30];//歌手
char album[30];//专辑
char year[4];//发售年份
char comments[30];//备注
char add[25];//MP3终极地址
unsigned char genre[1];//无意义
Mp3file *next;
};
class Mp3list
{
friend class Mp3file;
public:
Mp3list();
void addmanymp3(char a[]);
void addsinglemp3();
private:
int length;//歌曲总数
Mp3file *head;//歌曲链表的头抵制
Mp3file *end;//当前歌曲链表末位地址
};
Mp3list::Mp3list()
{
length=0;超市背景音乐
head=new Mp3file[1];
end=head;
}
void Mp3list::addmanymp3(char a[])
{
Mp3file *p2;
p2=new Mp3file[1];
int l;
char tuozhanming[10]="*.mp3";
l=strlen(a)+strlen(tuozhanming);前门情思大碗茶简谱
char *temp;
temp=new char[l];
贾爱国 sprintf(temp,"%s%s",a,tuozhanming);
WIN32_FIND_DATA p;
HANDLE h=FindFirstFile(temp,&p);//使用这个函数可以选定第一个查到的文件
puts(p.cFileName);//可能是输出查到的相关文件
fstream fp;
伤感2010 fp.open(strcat(a,p.cFileName),ios::in|ios::binary);
fp.seekg(-128L, ios::end);
fp.read(p2->TAG,4);//标签头
fp.read(p2->title,31);//歌名
fp.read(p2->artlist,31);//作者
fp.read(p2->album,31);//专辑名
fp.read(p2->year,5);//年代
fp.read(p2->comments,31);//文件描述
sprintf(p2->add,"%s",strcat(a,p.cFileName));
end->next=p2;
end=p2;
length=length+1;
while(FindNextFile(h,&p))
{
Mp3file *p1;
p1=new Mp3file();
char *temp2;
int le;
le=strlen(a)+strlen(p.cFileName);
temp2=new char[le];
sprintf(temp2,"%s%s",a,p.cFileName);
fp.open(temp2,ios::in|ios::binary);
puts(p.cFileName);
fp.seekg(-128L, ios::end);
fp.read(p1->TAG,4);//标签头
fp.read(p1->title,31);//歌名
fp.read(p1->artlist,31);//作者
fp.read(p1->album,31);//专辑名
fp.read(p1->year,5);//年代
fp.read(p1->comments,31);//文件描述
sprintf(p1->add,"%s",temp2);
end->next=p1;
end=p1;
length++;
}
FindClose(h);
}
void main()
{
Mp3list m1;
char address[20];
cout<<"请输入地址"<<endl;
cin>>address;
m1.addmanymp3(address);
}
发布评论