How to use ConfigContext::WriteItemValue
Hi,
From the documentation, I think I understand that I have to use the ConfigContext::WriteItemValue then.
I have a configuration parameter that I declare at startups as myconfigstring = new ConfigString(ctx, "name", "", true, false); This is by default empty and that is good. It is unmanaged since I want to update it from within the C++ code as well, and, SetValue can only be used in case it is an unmanaged key.
At a certain point I want to change the value.
I do this by calling myconfigstring->SetValue(newvalue.c_str()); but this doesn't change the database (I think? Please conform/deny).
I do this by calling myconfigstring->SetValue(newvalue.c_str()); but this doesn't change the database (I think? Please conform/deny).
From the documentation, I think I understand that I have to use the ConfigContext::WriteItemValue then.
So I call ctx->WriteItemvalue(myconfigstring, newvalue.c_str(), false);
However, this doesn't store the configuration value, because after the restart of my application the configuration key is again empty.
Then I see that the writeitemvalue function returns a task and i do
ITask* task = ctx->WriteItemvalue(myconfigstring, newvalue.c_str(), false);
task->Start();
But, also this doesn't work because after restart of my app, the value is again empty and not the value that I stored.
I run the app from the debugger. I'm sure the newvalue string is not empty.
Please provide some more details on how to save the value of the configuration parameter from within the C++ application.