I simply getting Segmentation Fault. Actually when I tried to assign two property, it is working fine as I described earlier. But instead, when I tried to assign one or three property, I am getting Segmentation fault.
There is a misunderstanding here. I agree the doc is not very clear on that point.
When you want to put/update device attribute property(ies), you need the following info:
The device name
The attribute name
The property name(s) and value(es)
The rule of the first DbDatum instance inserted in the DbData vector is to specify the attribute name and the number of
property to put/update. Its name is the attribute name and its value is the number of property to put/update.
In your first example, everything works fine because you specify 2 as the number of property to put/update and you insert
2 instances of DbDatum instance in the DbData vector (thus the vector has 3 elements).
In your second code snippet, you still specify that you want to put/update 2 properties but you provide
only one DbDatum instance!!