+ 2
Problem creating file
Here I have attached two codes both intending to work with files. In the fun code example involving class carreer doesn't open any file in the directory and render the program useless, however, the other short program creates a file in the same directory! And I used the same fstream statement to declare the file opening, please can anyone put through on this? I have tried several other programs like this involving classes and still file won't create, I have been stalked for like two days on this, it's frustrating. https://code.sololearn.com/c7ZW7RIsWtr0/?ref=app https://code.sololearn.com/cPX3F5x9T33e/?ref=app
4 Answers
+ 2
You should close your file with âfile.close()â comand after completing writing in it
+ 2
try to write it at the end of every function where you open file
+ 2
you are welcome
+ 1
Thanks @Madgod, I have actually found a solution to the problem I am having, when I run the program, I need to first and foremost call the function including the file declaration which I have been doing otherwise, thanks!