hi,
I'm trying to open a file from a command line argument and if it gets open
print a message.
it doesn't work
what am I doing wrong.
Code:#include <stdafx.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
int _tmain(int argc, _TCHAR* argv[])
{
FILE *input;
if (argc = 2) {
input = fopen(argv[1],"r");
if (input ==NULL){
printf ("cannot open the file");
}else {
printf ("\n File opened successfully \n");
}
fclose(input);
}
return 0;
}