各位大大好,我今天要用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;
}
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.
The audio file path needs to be specified correctly. In C++, you need to use double slashes (\) to avoid errors when using backslashes (). Change your file path as follows:
PlaySound("C:\RickRoll\RickRoll\music\RickRoll.wav", NULL, SND_SYNC | SND_FILENAME);
I use C++ language to create this online game website: slope game