iT邦幫忙

0

C++播放.wav音檔錯誤

  • 分享至 

  • xImage

各位大大好,我今天要用c++寫個程式來播放.wav檔,但是程式執行後沒有播出,想請問大大們我要如何解決此問題?

#include <stdio.h>
#include <windows.h>

int main(int argc, char *argv[])
{
    PlaySound("C:\RickRoll\RickRoll\music\RickRoll.wav", NULL, SND_SYNC|SND_FILENAME);

    getchar();
    return 0;
}
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

1
elena199x
iT邦見習生 ‧ 2024-07-25 12:16:12

You should check the file path, ensure the necessary header is included, and verify correct usage of the PlaySound function. If the Slope Game issue persists, consider sound card problems or compiler issues.

binyiWu iT邦新手 5 級 ‧ 2024-07-27 17:30:16 檢舉

I got it now.Thanks

0
YC
iT邦研究生 1 級 ‧ 2024-07-29 10:55:23

根據官方文件

PlaySound(TEXT("recycle.wav"), NULL, SND_FILENAME);

你路徑需要加上TEXT

參考

我要發表回答

立即登入回答