I would like to write my program in 2 different paths. So, I proceeded like that :
std::string path1 = strcat(std::getenv("APPDATA"),"\\myprog.exe") ;
std::string path2 = strcat(std::getenv("APPDATA"),"\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\myprog.exe") ;
When I print, I get :
C:\Users\thispc\AppData\Roaming\myprog.exe
C:\Users\thispc\AppData\Roaming\myprog.exe\Microsoft\Windows\Start Menu\Programs\Startup\myprog.exe
instead of :
C:\Users\thispc\AppData\Roaming\myprog.exe
C:\Users\thispc\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\myprog.exe
Solution by Dietmar Kühl :
std::string path1 = std::getenv("APPDATA") + std::string("\\myprog.exe");
Explanation by Oliver Charlesworth :
strcat()
changes the 1st variable