0
Visual Studio 2010 Expressで[デバッグ]ボタンを押すと、このコードを作成します。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 Express 2010にこの設定オプションがあることを願っています。数年前、VS Expressは多少不自由でしたが、多くの設定オプションが欠けていました...そして、リリース/デバッグの間で変更できなかったので、 ) – Max