c++ - relative path problem for a deployed win32 application -
i have written c++ program , deployed in c:\my_app, , executable's path c:\my_app\my_app.exe. say, my_app needs many files such the_file.txt, located in c:\my_app\the_file.txt.
in executable, open txt file as, xx.open("the_file.txt");
moreover, have associated program let's .myp extension.
when i'm on desktop, , want open file named example.myp, program can not see the_file.txt. because, (somehow) assumes it's working on desktop.
is there easy way handle problem changing shell command open in hkey_classes_root? naive solution change file open operations "%my_app_location/the_file.txt". don't want that.
thanks help.
always use full path name open file. in other words, don't open "foo.txt", open "c:\bar\foo.txt". find install directory of exe use getmodulefilename(), passing null module handle.
Comments
Post a Comment