So I have a small program which is supposed to write and read multiple objects from a file, but for some reason it doesn't write the information when I use "fstream" to create the object from the fstream class, but it does when I use "ofstream". Also, it doesn't read the information from the file no matter if I use "fstream" or "ifstream". I watched a video where this exact code worked just fine, but it just won't work when I run it. I'm using Dev C++ 4.9.9.2, I don't know if that has anything to do with it, I also tried it with Code::Blocks, didn't work either. Here's the code.
$ g++ --version
g++ (GCC) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4.5? you should really update. you are four minor releases behind. @op: your ide doesnt matter (although i believe dev is deprecated). its your compiler. also, are you sure you have the rights?
So I somehow managed to make the program work for me and everything's fine, thanks for you help. Now I have another problem. I changed the code so it would have a menu and it works fine, but when I select the option "Show information" it only shows the information once, when I select it again it doesn't show me anything unless I restart the program. Any ideas how I can solve this problem.