diff --git a/opcua_client.cpp b/opcua_client.cpp index e823374..d37727b 100644 --- a/opcua_client.cpp +++ b/opcua_client.cpp @@ -11,7 +11,7 @@ int main(int argc, char* argv[]) { << " [Interval-in-seconds]\n\n" << "Example:\n" << argv[0] - << " opc.tcp://192.168.1.100:4840 ns=2;i=2 1\n"; + << " opc.tcp://192.168.1.100:4840 \"ns=2;i=2\" 1\n"; return 1; } @@ -28,12 +28,12 @@ int main(int argc, char* argv[]) { // 2. Read Node Value uint16_t nsIndex = std::stoi(nodeText.substr(nodeText.find("ns=") + 3, nodeText.find(";") - (nodeText.find("ns=") + 3))); - std::size_t sPos = nodeText.find("s="); + std::size_t sPos = nodeText.find(";s="); std::string stringNodeId; uint32_t numericNodeId; std::string value; - if (sPos != std::string::npos) stringNodeId = nodeText.substr(sPos + 2); + if (sPos != std::string::npos) stringNodeId = nodeText.substr(sPos + 3); else numericNodeId = std::stoi(nodeText.substr(nodeText.find("i=") + 2)); do {