I'm write a code in c++. that code read an input data from a file,this is apart of my code:
// .cpp : Defines the entry point for the console application.
//
#include<iostream>
#include<fstream>
#include<cstring>
#include<stdio.h>
#include "stdafx.h"
//-------------------------------------------
using namespace std;
int main(int argc, char* argv[])
{
char inFileName[100];
printf("Hello World!\n");
if(argc<2)
{
cout<<"Please enter an input file name\n";
exit(1);
}
strcpy(inFileName,argv[1]);
ifstream f(inFileName,ios::in |ios::binary);
if(!f)
{
cout<<"Can't open file.\n";
return 1;
}
return 1;
}
when i do the run the file is not exit.
it print please enter file name.
please help me,and another qustion, the statement ifstream f(inFileName,ios::in|ios::binary) help me to open the file or i should to write the open file statement.
Thanks

