下面是我的代码,只是在播放的地方不出声音。运行着是没有问题。求教大神,急切
#include
#include
#include
#include
#include
#pragma comment(lib,"winmm.lib")
bool Relist(struct _finddata_t list[])
{
char load[99];
printf("\n");
gets(load);
int i=0;
long handle;
handle=_findfirst(load,&list[i]);
if(handle==-1)return false;
printf("%d.%s\n",i+1,list[i].name);
i++;
while(!_findnext(handle,&list[i]))
{
printf("%d.%s\n",i+1,list[i].name);
i++;
}
return true;
}
void Play(struct _finddata_t list[])
{
char str1[99]="open",str2[99]="alias song";
int num;
printf("\n");
scanf("%d",&num);
strcat(str1,list[num-1].name);
strcat(str1,str2);
mciSendString(str1,0,0,0);
mciSendString("play song",0,0,0);
}
int main()
{
struct _finddata_t list[999];
Relist(list);
Play(list);
return 0;
}