1

I am looking for easy form of saving (like JSON) in C++.

The file should be easy to read for users.

It means the laic can modify the file for his needs.

The biggest advantage should be no external library.

Thanks!

John Doe
  • 11
  • 1
  • Saving is easy, just print to a text file all the values. But you probably want to read back, too. In that case you will sooner or later learn that "no external library" is NOT an advantage. – Yunnosch Sep 24 '19 at 20:18
  • JSON structure is best what I have seen. But it requires external JSON parser. – John Doe Sep 24 '19 at 20:20
  • Yes. Go for it. – Yunnosch Sep 24 '19 at 20:21
  • 1
    The right way to store data in files depends enormously on the type of data to be stored and the expected access pattern. – user4581301 Sep 24 '19 at 20:22
  • 1
    what do you need it for? What do you want to save in the file? – 463035818_is_not_an_ai Sep 24 '19 at 20:22
  • 1
    Soooo, what do you want? Do you want a general approch to serialization using c++? What have you done so far and where is the problem? – Lukas-T Sep 24 '19 at 20:22
  • 4
    What is "laic", as in your title? – Thomas Matthews Sep 24 '19 at 20:37
  • I am looking for something like array of animals. Each animal has different name or age. Laic can easy add animal and its name or age. But it need to be scalable (if I need to add new property or array or object to already created animal). – John Doe Sep 24 '19 at 21:21
  • @ThomasMatthews I too believed laic would be a typo, but apparently it's an english word, we never heard of or used ^^ – Lukas-T Sep 25 '19 at 06:57
  • @JohnDoe Thats good, you know, which data you will have in your program. Next you need to think about how you want to print the data (format, possibly encoding). And the third step will be to write some code. If you want serialization to json, you could take a look at [this question](https://stackoverflow.com/questions/17549906/c-json-serialization). – Lukas-T Sep 25 '19 at 06:58
  • According to a dictionary, "laic" is only used in religious context. What you mean is probably "layman" or "layperson". – paleonix Apr 27 '22 at 19:18

1 Answers1

0

There are only header libraries like taoJSON, you can add this in your project very easy. Better try this before do a lot of job.

Mauricio Ruiz
  • 322
  • 2
  • 10