Click here to Skip to main content
15,896,730 members
Please Sign up or sign in to vote.
1.80/5 (5 votes)
See more:
I know in C# its

C#
Propitites.settings.default.savestring;
Propitites.settings.default.save();


and in VB the code is

VB
My.settings.savestring
my.settings.save


but I was wondering if there was one for C++ because I can't seem to find one, if anyone knows how to fix this or if the isn't a method, if there was a way like this that will save the settings in the program
Posted
Comments
[no name] 8-Jul-12 21:13pm    
Nothing that I have ever found
[no name] 8-Jul-12 21:17pm    
This comment makes no sense, please rephrase
[no name] 8-Jul-12 21:22pm    
Okay... I will rephrase. There is nothing in C++ that I have ever found that is built into the API like there is for C# and VB even though I conducted months of searching and looking at the API's and I have always had to roll my own solution to save the application settings because I have never found anything in C++ to save the application settings that was built into the .NET framework.
[no name] 8-Jul-12 21:25pm    
ok ty, what was your own solution?
Sergey Alexandrovich Kryukov 8-Jul-12 21:32pm    
You are comparing apples and oranges. When you speak about C# and VB (actually, this is a completely different language called VB.NET), you are talking about .NET, but C++ could be anything. Is this is C++/CLI? then it is the same. Anything else? What? I what's a big deal? Saving settings? You can always use streaming to persist some setting model. With .NET, I don't use standard settings since Data Contract is available.
--SA

C++ does not offer that feature.

You need to do it yourself, or find a library that does it (I think I might have seen something here on CP about it).
 
Share this answer
 
Here is a common solution used by many c++ developers: Boost PropertyTree[^]

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 11-Jul-12 15:59pm    
This is something I wanted to advise a minute ago, but found your answer. My 5.
--SA
Espen Harlinn 12-Jul-12 3:45am    
Thank you, Sergey :-D
There isn't one, you have to write your own. You also need to understand that C++ programs do not have default property sets (I assume that's what you mean by the term Propitites).
 
Share this answer
 
You might have to use profile strings, like SetProfileString/GetProfileString. But this is mostly up to you how to implement this. In MFC you also have such things implemented like serialization.
If you have from C++ to read the values saved in C#, then you need to take a look inside C# implementation.
All you have to know, is that shared values in some way are stored in shared resources, like XML files, ini files, databases, any kind application format specific files, registry, system ini files....
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900