C++ StaticString to String

Hi All! I’m reworking a the costum notification sender to be more flexible in the future. I’m trying to convert a StaticString<80> to a string type to fit in the „example payload“ of the example provided in GitHub.

But I’m probably missing something as I can’t succeed. Can someone give a hint? I guess I can convert a byte array to a string as well, is this the preferred way? Kind Regards Dries

Hello Dries,

please the following code:

//Definition in Component or Program header file:
pcoslib::IecString80 strValue;

//Initionalisation in C++ code:
this->strValue.SetCapacity(this->strValue.Capacity);
this->strValue.Remove(0);

//Convert the IecString80 to string:
string strNormValue((char*)strValue->Begin());

I’dont test it, but it should work.

Best Regards
Eduard