2

我在尝试构建这个“简单”程序时遇到了一些麻烦。

我的目标是创建一个 C 程序,它执行一个说“Hello”的 mp3 声音文件并在 Windows 启动时运行。

#include<stdio.h>

main(int argc, char *argv[]){

FILE *fp;
char s[100];
int i;


    if((fp=fopen("Hello.mp3","rb"))==NULL) //Open file and read on binary mode
       { 
         printf("Could not open the file\n");
         exit(1);
    }

fclose(fp);


 }

我认为要解释 MP3 编码数据,我必须使用库,但我真的需要帮助。

此致,

里卡多

4

1 回答 1

3

我认为我们不能像任何常规文本文件那样以这种方式打开 mp3 文件。

fp=fopen("Hello.mp3","rb")

我们必须使用编解码器,才能真正播放 mp3 文件,或者至少使用有一个库。

一定要看看这些地方。

如何在 C 中播放 MP3 文件?

SDL 混音教程

于 2013-02-28T02:31:29.980 回答