First, I should tell you that I use DEV C++ to write my program.
Ok, to the point now... I wrote a program that gets input from a file named "candidates1.txt". So, the first lines are:
main() {
FILE *fp;
fp = fopen("candidates1.txt", "r");
fscanf(fp, "%d %d", &N, &length);
// ...
and the rest I believe don't matter. If I run the program like this, I get the desirable output. But, if I changed it to this:
main(int argc, char *argv[]) {
FILE *fp;
fp = fopen(argv[1], "r");
fscanf(fp, "%d %d", &N, &length);
// ...
and try to run it, nothing appears as an output and the command line closes. Could somebody tell me why is this happening?