Hello all. I've been trying to use the PlaySound(); function with no success. Basically what is happening is i'll build and run the program, the console will appear giving me a sliver of hope... then all of a sudden I get an error "System could not find the path specified." I've quadruple checked the path and it seems right, I moved it around different places as well. The last place I put it was in the project folder. I'm not sure exactly whats up with it. I added winmm.lib in my linker settings, and here's what my code looks like.
Nah, you should use GetCurrentDirectory (first modoran's post on the topic) and strcat the filename, because if you just use 'g.wav' and this file is in some other path, but still in the PATH environment, that specific 'g.wav' will be played.
Not sure, but try putting some 'Never Gonna Give You Up' wave file as 'g.wav' in the same directory of explorer.exe and run again your program.
Please consider that is a difference between working directory and executable directory.
You can explicitly specify the working directory, I know. You should use the working directory, not the executable directory anyways, because of that reason.
That will be useless work, as the working directory is searched first anyway if you just use a relative path.
But what if you wanted, in case g.wav didn't exist, to run h.wav? If g.wav is in another path, you didn't hear the h.wav but heard a wrong g.wav.
Anyways, I think it's slower to use a relative file name than an absolute one.