怎么用C语言打开一个MP3文件吖?

来源:百度知道 编辑:UC知道 时间:2024/06/09 08:31:53
想用C打开一个MP3文件,当然是有路径的.请知道的朋友说下.最好给出一小段代码.谢了

用VS2003或2005建一个带MFC的名为Mp3Player的控制台应用程序,把这些代码复制到Mp3Player.cpp

// Mp3Player.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include "Mp3Player.h"
#include "mmsystem.h"

#pragma comment(lib, "Winmm.lib")

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

// 唯一的应用程序对象

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;

// 初始化 MFC 并在失败时显示错误
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: 更改错误代码以符合您的需要
_tprintf(_T("错误: MFC 初始化失败\n"));
nRetCode = 1;
}
else
{
//"Chart Files (*.xlc)|*.xlc|Worksheet Files (*.xls)|*.xls|Data Files (*.xlc;*.xls)|*.xlc; *.xls|All Files (*.*)|*.*||";
CFileDialog OpenFileDlg(TRUE ,
NULL ,
NULL ,
OFN_HI