-2

I write a program using Visual C++, which needs to save some application specific data. I just wonder:

  1. Where should I store the data? It seems that there is a folder called "C:\Users\xxx\AppData\Roaming" that will be used to store app data. Then how to obtain such a folder for a specific user.

  2. Is there an easy-to-follow sample that demonstrates how to do that? I just find an article, but it is just for C#. Is there a good sample for C++?

Thanks

zet
  • 169
  • 10
  • 2
    Please make your questions self-contained. Don't have *just* links to entire articles on external sites. Present a summary in your own words. – StoryTeller - Unslander Monica Jan 10 '18 at 09:36
  • [std::fstream](http://en.cppreference.com/w/cpp/io/basic_fstream) may be of interest. – Galik Jan 10 '18 at 09:40
  • If you are searching for the MS specific C/C++ way - this may help: [SO: SHGetFolderPath Deprecated: What is alternative to retrieve path for Windows folders?](https://stackoverflow.com/q/18493484/7478597) – Scheff's Cat Jan 11 '18 at 07:57

1 Answers1

1

C++ doesn't contain a app setting feature out of the box.

You could build something by hand, using files/streams.

You could use a library, for example, boost::program_options (see this discussion).

doctorlove
  • 18,872
  • 2
  • 46
  • 62