/* 案例4 从U盘到MP34
播放音乐
让U盘把内容写入文件
让播放器播放mpg 或avi视频
*/
// "MP3"模拟程序
#include<iostream>
#include<windows.h>
#include <mmsystem.h>
#include <fstream>
#pragma comment(lib,"winmm.lib")
using namespace std;
///
// UDISK 窗口类,父类
///
class UDISK
{
private: //私有成员
char *crow[100];
int nrow;
public:
UDISK (void) //构造函数
{
nrow=0;
}
void read(void); //读数据
void write(char *pstr); //写数据
};
//读数据
void UDISK ::read(void) //读数据
{
int i=0;
for(i=0;i<nrow;i++)
{
cout<<crow[i]<<endl;;
}
}
//写数据
void UDISK ::write(char *pstr) //写数据
{
ofstream out("E:\\U.txt");
if (!out)
{
cout<<"Cannot open file.";
exit(1);
}
crow[nrow]=pstr;
nrow++;
int i=0;
for(i=0;i<nrow;i++)
{
out<<crow[i];
}
out.close();
}
///
// MP3 类,子类
///
class M