I have a custom application (EMA C++ based) sending a post request containing a field value as follows:
<fieldEntry fieldId="393" data="4154 3030 3030 3338 3338 3634 00"/>
The definition of the field in concern is as follows:
OFFCL_CODE "OFFICIAL CODE" 78 NULL ALPHANUMERIC 12 RMTES_STRING 12
The length of the string is 12, but the payload contains 13 bytes, because of the null terminating character.
I'm quite sure I am using the EMA library in an incorrect way, would you please confirm?
My approach is as follows:
- emaBuff is of type refinitiv::ema::access::EmaBuffer
- value is of type refinitiv::ema::access::EmaString
- res is of type refinitiv::ema::access::FieldList
emaBuff.append(value.c_str(), value.length() + 1); res->addRmtes(393, emaBuff);
From the EMA samples, I see that EMABuffer is built in different ways, so I'm not sure about the correct one. Example:
Elektron-SDK-1.3.0.L1.linux\setup\Cpp-C\Ema\TestTools\QATools\Series100Provider100-ProvFunc-002\IProvider.cpp, line 139
In other cases (the majority), the length passed to the buffer is the string length without the null terminating character.