2
votes

i am trying to play a sound file with spaces in its name

example: "my File.wav"

So sending files like this:

mciSendString("play C:\\myFile.wav",0,0,0);

will work just fine. but:

mciSendString("play C:\\my File.wav",0,0,0);

will fail.

is there any solution to this problem?

1
On Windows, wrap paths containing spaces with quotation marks: mciSendString("play \"C:\\my File.wav\"",0,0,0);.Mateusz Grzejek
Posted this as an answer, as I didn't have time to do this yesterday. I am glad it worked.Mateusz Grzejek

1 Answers

1
votes

On Windows, paths containing white characters must be wrapped with quotation marks. So instead of:

mciSendString("play C:\\my File.wav", 0, 0, 0);

write this:

mciSendString("play \"C:\\my File.wav\"", 0, 0, 0);

That should work.