Boolean value always returns 0 while reading in qt creator

751 views Asked by At

I am trying to read a boolean value from a device.Here is the code:

bool attr26Value;
DeviceAttribute attr26;
attr26 = device2->read_attribute("attribute_name");    
attr26 >> attr26Value;  

When I check the values returned into I can see boolean values 'true'/'false' in it. But now if I check the value of attr26Value it always shows 0 whether attr26 is 'true' or 'false'. I went through a link which suggested using "std::boolalpha", I tried using that and I get this error:

"no match for operator>> in attr26 >> std::boolalpha"

Could you let me know the reason for this error and how it can be resolved?

0

There are 0 answers