Hi, I have a couple of c++ questions that I can't find the answer to. First of, if I use the code below to open a user defined text file, how do I prevent the user from overwriting an existing file?
char filename[50];
cout <<"Enter a file name for output: ";
cin >> filename;
cout << endl;
std:fstream file;
file.open(filename);
Secondly (and this is really bugging me), how do I set up a variable that will allow a user to enter text including whitespaces? When I tried this with char I got a error.
Thanks for the help
Will
char filename[50];
cout <<"Enter a file name for output: ";
cin >> filename;
cout << endl;
std:fstream file;
file.open(filename);
Secondly (and this is really bugging me), how do I set up a variable that will allow a user to enter text including whitespaces? When I tried this with char I got a error.
Thanks for the help
Will