I need to create a file with custom file name. Person has to imput the files name and then it is checked if it exists or not. After that it gives a response.
This is the code fragment:
cout << "Enter book's ID:" << endl;
cin >> bookID;
cout << "The file already exist!" << endl;
of << "Author:" << endl;
of << "Title:" << endl;
cout << "New file have been created!" << endl;
1. After everything is done the console crashes.
2. It creates .file and not .txt. I would prefer that it would be .txt, but if there is no other way then I could work with .file
I think it is somehow related to char*, but it is a requirement for ifstream and ofstream.
I been trying to find this solution but no luck so far.
Thanks in advance.
Last edited on