When I press the Debug button in Visual Studio 2010 Express. And build this code
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;
}
Where does the myfile.bin go. I know where it goes when I run the program by double clicking on it. But if I'm debugging the file doesn't appear in the projectName/debug directory.
Edit: Apparently this program will find the location. But it usually the same directory as your source files.
#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);
}