Not able to find external files -
I am a cheat programmer and having trouble directing my compiler that I use const char to create some image files Find me
I c. Kelly is reading through a program, "Programming 2D games", and when I look at my code, she uses this line to find her image file.
const char NEBULA_IMAGE [] = "Image \ NasaNebula.jpg"; // Photo source nasaimages.org
When I do this I get an error that I did not get the file. However, if I use this line:
const char NEBULA_IMAGE [] = "E: / TestProject / Pictures / NASA Nebula JPG."; // photo source NASA
does this work Can anyone tell me how can I configure my project so that these files can be found without defining their exact path? I've been looking around for some time, but in fact I do not need it.
Thanks
Since that path is used on runtime (time compilation Not in), to find and load that file, you need to make sure that the relative path of this type is understood by the current state. You need to make sure that is the current working directory of your application, goes to the relative path file from that directory . Applications that work in your specific example should be in the Many flexibility is offered in the normal relative path, for example, by using different resource folders on runtime, thus changing the source code of the application Using different files. But the relative path also demands that the current position of the app allows to solve such routes. E: / TestProject so that the relative path leads to
pictures / nasanbula.jpg Complete (and true) path
E: /TestProject/pictures/NasaNebula.jpg .
Comments
Post a Comment