c++的库函数_getcwd为什么总是得到桌面地址?
  • 板块灌水区
  • 楼主rmxlinux
  • 当前回复4
  • 已保存回复4
  • 发布时间2020/8/29 21:49
  • 上次更新2023/11/5 13:59:41
查看原帖
c++的库函数_getcwd为什么总是得到桌面地址?
86896
rmxlinux楼主2020/8/29 21:49

RT,下面一段代码:

char tmpPath[MAX_PATH] ;
_getcwd(tmpPath, MAX_PATH);
std::string path = tmpPath ;
BinCommand = "g++.exe \"" + Next + "\" -o\"student.exe\" -m32 -I\"..\\x86_64-w64-mingw32\\include\" -L\"..\\x86_64-w64-mingw32\\lib32\" -static-libgcc -lgdi32 -lcomdlg32 -m32" + " & move student.exe " + path + "\\" ;
printf("%s\n", BinCommand.c_str()) ;

然后path一直是

C:\Users\Administrator\Desktop\

输出则是

g++.exe "D:\Hadus\apb-test.cpp" -o "student.exe" -m32 -I"..\x86_64-w64-mingw32\include" -L"..\x86_64-w64-mingw32\lib32" -static-libgcc -lgdi32 -lcomdlg32 -m32 & move student.exe C:\Users\Administrator\Desktop\

求教大佬,我的程序路径不是桌面啊???

2020/8/29 21:49
加载中...