Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/137.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如果我将CurrentDirectory设置为Win7 64位上32位应用程序中的C:\Program Files,文件重定向将不起作用,它是否应该导航到(x86)文件夹?_C++_Winapi_64 Bit - Fatal编程技术网

C++ 如果我将CurrentDirectory设置为Win7 64位上32位应用程序中的C:\Program Files,文件重定向将不起作用,它是否应该导航到(x86)文件夹?

C++ 如果我将CurrentDirectory设置为Win7 64位上32位应用程序中的C:\Program Files,文件重定向将不起作用,它是否应该导航到(x86)文件夹?,c++,winapi,64-bit,C++,Winapi,64 Bit,下面是我的测试代码 //This correctly prints C:\Program Files from 64 app on 64 bit Win7 and //C:\Program Files (x86) 32 bit app on 64 bit Win7 system("echo %PROGRAMFILES%\n"); BOOL ret = SetCurrentDirectory("C:\\Program Files\\"); char szFolder[512] = {0}; G

下面是我的测试代码

//This correctly prints C:\Program Files from 64 app on 64 bit Win7 and
//C:\Program Files (x86) 32 bit app on 64 bit Win7
system("echo %PROGRAMFILES%\n");

BOOL ret = SetCurrentDirectory("C:\\Program Files\\");

char szFolder[512] = {0};
GetCurrentDirectory(512, szFolder);

//folder is printed as C:\Program Files from 32 bit app on 64 Win7! Why?
cout << "Current folder now: " << szFolder << endl;
//这将在64位Win7和
//C:\Program Files(x86)64位Win7上的32位应用程序
系统(“回显%PROGRAMFILES%\n”);
BOOL ret=SetCurrentDirectory(“C:\\Program Files\\”;
char szFolder[512]={0};
GetCurrentDirectory(512,szFolder);
//文件夹打印为64 Win7上32位应用程序的C:\Program文件!为什么?

这很简单。
程序文件
目录不受限制


您可能最好使用
CSIDL\u PROGRAM\u文件
CSIDL\u PROGRAM\u文件x86
值,但您必须自己确定是否需要x64或x86文件夹。

它只与System32文件夹有关?