[Dev-C++] (bug) passing a filename to a console program is broken
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Alexei P. <apo...@ch...> - 2000-11-16 02:30:24
|
Passing a file name to a console program as a parameter requires full
path to work by clicking "Run" under IDE. Without full path the
executable is not able to locate and open the file. Normally, the
executable should find the file in the working directory. This means
that the environment option to "execute in directory of executable" is
not working even if checked. In fact, the executable runs in
c:\dev-c++\bin\ directory, I suspect.
To observe the behavior
1) run devcpp.exe from program menu.
2) compile this program:
#include<stdio.h>
main(int argc, char** argv)
{
FILE *f;
if ( argc > 1 )
{
f=fopen(argv[1],"rt");
if( f==NULL )
printf("File %s has not been found!!!",argv[1]);
else
printf("File %s has been found and opened. ;\)",argv[1]);
}
else
printf("No file name has been passed!");
printf("\n press any key...");
getchar();
}
3) try to pass an existing file name to this problem and run it under
dev-c++.
Running devcpp.exe in the directory of executable solves the problem.
Unfortunately, recompiling resets the working directory from the
directory of executable.
|