0

我正在尝试从设备中读取布尔值。代码如下:

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

当我检查返回的值时,我可以在其中看到布尔值“真”/“假”。但是现在如果我检查 attr26Value 的值,无论 attr26 是“真”还是“假”,它总是显示 0。我浏览了一个建议使用“std::boolalpha”的链接,我尝试使用它并收到此错误:

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

您能否告诉我此错误的原因以及如何解决?

4

0 回答 0