0
当我按在Visual Studio 2010 Express中的Debug按钮。并建立此代码是否调试在另一个文件夹中的Visual Studio的地方建文件
int main(int argc, char *argv[])
{
FILE * wFile;
float wbuffer[] = { 1 , 2 , 3, 4};
wFile = fopen ("myfile.bin" , "wb");
fwrite (wbuffer , 1 , sizeof(wbuffer) , wFile);
fclose (wFile);
/*BREAK POINT HERE*/
return 0;
}
myfile.bin在哪里去。当我通过双击运行程序时,我知道它会发生什么。但是如果我正在调试该文件没有出现在projectName/debug目录中。
编辑:显然,这个程序会找到位置。但它通常与源文件的目录相同。
#include <stdio.h>
#include <direct.h>
#define GetCurrentDir _getcwd
int main(int argc, char *argv[])
{
char cCurrentPath[FILENAME_MAX];
if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)/sizeof(TCHAR)))
{
return errno;
}
cCurrentPath[sizeof(cCurrentPath) - 1] = '\0'; /* not really required */
printf ("The current working directory is %s", cCurrentPath);
}
我希望VS快讯2010年有此配置选项,在几年前的VS Express时有所削弱,而错过了许多配置选项......我快要疯了,因为我没能释放/调试之间切换: - ) – Max 2012-01-27 20:45:21