How to save application data for future use

Well, that’s why I am working on a windows c application and uses various types of structures that store data and display to the user. I want to use saveDialogBox to allow the user to save information (e.g. configuration, state). The only way I can do this is to make a procedure that goes through the structures and write the corresponding elements to a text file. After loading, this procedure will be used to load data back.

This, of course, is a dumb way to do this, I admit. Everything that I did at school was written only in text files. Are there other ways to make some formatted files to save and load?

I was looking for serialization to save objects to files. I'm not too sure how it all works. help.

+4
source share
2 answers

My "old school" has always been to save settings during program execution in the database (provided that you take the time to make sure that you do not clog the database with updates / inserts).

If my application should be more efficient, I need to easily remember the saved settings that I serialize in XML using System.Xml.Serialization (from memory). XML serialization is human readable, which is useful (but not the most efficient in terms of processing time).

If I need even more efficiency, you can follow the path and serialize to a binary file.

I would suggest reading / understanding http://msdn.microsoft.com/en-us/library/Vstudio/ms233843.aspx before returning here. I would say that as soon as you read this, you will be much better prepared to decide how you want to accept your application.

In my experience, there are not many DUMB ways to solve problems, but there is almost always a better way to solve them, given enough time and research.

-1
source

Source: https://habr.com/ru/post/1486709/


All Articles