I have the following code which gets the name of a .mp3 file and passes it to a function to play it. It works if i set szFile to the name of a file manually in the source, but when i have it pass szFile to the function, it won't play
And second, you could cout << szFile before PlaytheSound, to see what the string is
Edit:
1 2 3 4
ofn.lpstrFile = szFile;
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
ofn.lpstrFile[0] = '\0';
Wtf? i think youre supposed to do szFile[0] = 0 not ofn.lpstrFile[0], that messes up / removes the pointer to szFile
That first bit replaces \ with /. I have cout'd szFile and it gives me the file name, eg. C:/Users/beep.mp3. And if i use PlaytheSound("C:/Users/beep.mp3"); it works, just not when i get it using the openfile window.
The code i got from MSDN so im pretty sure its correct.