S
S
Spooky 20202021-05-06 19:01:56
C++ / C#
Spooky 2020, 2021-05-06 19:01:56

Best practices when using files to load and store program data?

I am writing an ordering program, a list of menu items, prices and all that I plan to load from a file.
What approach should I use if I plan to use a data file of the form:
какой то текст = 1.50 = 1 = еще какой то текстthe symbols "equal" are not important, I can use any.

What is the best way to parse it - just use String.Split() or some library (a friend said that it is better to always use specialized things for parsing CSV files)?

Also, it is possible that during the program operation, the data received from the file will be expanded and supplemented
by the user, what is the best way to save these changed states? To fasten something like SQLIte or serialize?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-05-06
@spooky_2020

1. I do not recommend using this format, for the interface, take a more flexible format like toml, yaml, or XML
2. Use json or csv for data. Ready-made solutions already exist
3. If you need to store the data that the user enters through the interface, then use some kind of database.
4. If this is a desktop application, then it is quite possible to use an embedded database, such as sqlite

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question