开发者

Where to store data?

开发者 https://www.devze.com 2023-02-03 07:17 出处:网络
I have created a c++ program but now I need to store on the hard disk permanently some settings about the program.

I have created a c++ program but now I need to store on the hard disk permanently some settings about the program.

Where do I have to store this data ?

  • In a sqlite database ?
  • In the windows registry ( if linux ? ) 开发者_开发问答?
  • In a XML file
  • In other files ?


It completely depends how much information it is and for which platform.

Viable options are a .ini file http://en.wikipedia.org/wiki/INI_file#Accessing_INI_files and for more data a SQLite database. I'm not a big fan of XML files.


It depends on the type and size of data. For small and less complex data simple text files are better. for complex data you can use XML or sqlite database. If you need to write complex queries go for sqlite. It stores data in files but will give better query options.


Modern applications use the system registry to store configuration information.

See the windows article: Using the Registry in a C++ Application

http://msdn.microsoft.com/en-us/library/ms838625.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消