Please could you look at the code and make some changes to it then post it here 4 me to see what it is thats the matter??
Code:
{
system("cls");
cout<<"Selection 1. Create a new file and input some text."<<endl;
cout<<endl;
cout<<setfill('-')<<setw(80)<<"-"<<endl;
cout<<"Please enter the directory and filename:";
getline(cin,filename);
ofstream a_file(filename.c_str());
if ( !a_file.is_open() )
{
a_file.close();
ifstream b_file(filename.c_str());
cout<<"Please input some text that will be written to the file you specified."<<endl;
cout<<">";
getline(cin,text);
cin.ignore();
cout<< text;
b_file.close();
ofstream c_file("D:\\W_INFO\\LUF.txt");
c_file<< filename;
c_file.close();
break;
}
else
{
system("cls");
cout<<"Error: File already exists please specifiy a different name.";
cin.get();
system("cls");
break;
}
}
Headers:
Code:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <windows.h>
Please if someone has the time look at this.