I am trying to use the playsound function i have the code

PlaySound(L"C:\Documents and Settings\Louisa\My Documents\Visual Studio 2010\Projects\Ninja_Wars\Ninja_Wars\music.wav",NULL,SND_FILENAME|SND_ASYNC | SND_LOOP);

  Sint32 delta;

But when i play the game all i hear is a beeping sound- the one windows has when there is an error or something. Can anyone help me as to why this is happening?

Hi new2programming :-)

Replace \ with \\ in the string.

\ is used to put special characters in a string ('\n' is a newline). To put a '\' in a string you type '\\'.

The beeping sound might be caused by the fact that the file can't be found.

1. Replace '\' with '\\'
2. Use parameter SND_NODEFAULT to suppress the beep when no file is found.
3. PlaySound can only play .wav files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.