C++ (using files as database) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

C++ (using files as database)

How can i permanently create a file and store things to it every time it runs and will still be accessible later in --C++

24th Jul 2018, 3:00 AM
Johnson Hope Opeoluwa
Johnson Hope Opeoluwa - avatar
2 Answers
+ 9
Once you create a file it will be permanently saved.
24th Jul 2018, 3:23 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
I just want to complement the answer of Dark Angel. If you want to use a file as db, C++ class fstream and the related ones offer many options: for example you can have a text file or a binary file (with this one you can save your objects directly), you can open a file only for reading/writing or both, the new content can be appended at the of the file, etc... As an example, see this code: https://code.sololearn.com/czgs0L9Om9WY/?ref=appt You will need to execute it on your machine to watch the file being modified. I also recommend as reading: http://www.cplusplus.com/doc/tutorial/files/ Good coding.
25th Jul 2018, 9:55 AM
Mark