高手帮忙改改C++代码
下面代码是打开文件的C++代码, 但是打不开。不知道哪里出问题了。编译的话是没有错误的。 高手请教一下·void main()
{
char file_name_in[20];
char file_name_out[20];
int ptr;
ifstream inFile;
ofstream outfile;
do
{
do
{
cout<<"Enter the input file name: ";
cin>>file_name_in;
cout<<"Enter the output file name: ";
cin>>file_name_out;
ptr = strcmp(file_name_in, file_name_out);
if(ptr==0)
{
cout<<"Silly! Make the names different!";
cout<<endl;
}
}while(ptr==0);
inFile.open(file_name_in,ios::in);
if(!inFile.fail())
{
cout<<"I could't open"<<" "<<file_name_in<<" "<<"I'm giving up. Sorry!";
cout<<endl;
}
}while(!inFile.fail());