On 18.06.2015 23:15, Hotmail (ArbolOne) wrote: > This question is exclusively for Win users. > OK, having said that, I have a desktop and a laptop. In the desktop I use > MinGW64 and the GCC compier as well as CodeBlock, but on the laptop I use > VS2015 and VC++. In my desktop I wrote a program that plays a sound file, > the structure of the file directory is like so: > D: > | > Program Files {parent directory} > ArbolOne ( folder ) > |__ Sound ( folder ) > |_____Sounds.exe > > In my application the code looks like this: > > player->Play(L"D:\\Program Files\\ArbolOne\\Sound\\KimPossible.wav"); > 1) Variable things like that can be made configurable. Use .ini files (that's probably the easiest way) or the registry. This way you can point it to the right file to play on any machine, wherever that file is. 2) You can query the location of the exe file from which currently running process was loaded with GetModuleFilename() and find the file that way (assuming that it is always at the same location relative to the executable). 3) You can split the program into two parts - binaries (which can be anywhere, in Program Files, for example) and data files (which will be stored in a specific location, such as %APPDATA%). -- O< ascii ribbon - stop html email! - www.asciiribbon.org
Attachment:
0x922360B0.asc
Description: application/pgp-keys
Attachment:
signature.asc
Description: OpenPGP digital signature