i'm working on a small project where i'm storing student details in an array of structures.The admin logs in to modify these details.How do i get this data to remain permanent?(i.e the data entered should not be erased every time i re-open the program)

Is there no way other than using the concept of files?If the answer is no,please tell me how to do it with files.

Recommended Answers

All 4 Replies

You will need either files or a database (such as MySQL).

Your application stores all the data it requires at runtime in RAM. RAM is known as volatile memory, because once you remove power to the device, it resets. This is intrinsic to the electronics and cannot be changed.

The reason your program "forgets" everything after you close and re-open it, is because your application runs in its own little block of memory and the Program/Operating System cleans it up when the application closes. Failure to do so is a memory leak. RAM is not meant to be used as permanent storage. That's what the HDD is for.

To learn about files, look at the fstream and iostream headers. If you want something more OS Specific, you will need to Google it =)

You will need either files or a database (such as MySQL).

Which are files :icon_rolleyes:

Which are files :icon_rolleyes:

Semantics! I was making a differentiation between storing it directly to a file, or using an existing database engine ;)

thanks :icon_smile:...i'll try working on it using files

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.