Hi this is my first post and i hope it is easy to understand
I use dev bloodshed c++
I use windows xp 32bit
I'm working on a text based video game in console application.
i started a new project to test the ability of playing sounds to add into the main program afterwords. I have the Playsound command wrking but i need to be able to have the program able to read the WAV files from the folder that the program is in. So instead (for example) of having: PlaySound("C:/Windows/Media/test1.wav", NULL, SND_FILENAME);
i need a path that doesn't use anything direct, i just need it to say that the file is in the project folder. I tried : PlaySound("/test1.wav", NULL, SND_FILENAME); but it only does the C drive; is thier something that can say the root folder?
Here's my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include<iostream>
#include<windows.h>
#include<mmsystem.h>
#include<stdlib.h>
usingnamespace std;
int main (char argc)
{
PlaySound("/test1.wav", NULL, SND_FILENAME);
system("pause");
return 0;
}
//reads from C:/test1.wav//
hehe, talk about complicated! You missed the simplest: PlaySound("test1.wav", NULL, SND_FILENAME);. That should play the sound from the executable's working directory.
Basically / return the root directory C:/ in your case although you don't want the root one. You want the pwd (present working directory).
I think @webJose suggestion would be satisfactory