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.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.
Looking at the EMACPP_DevGuide, for a similar usage scenario, I can see the EmaBuffer length is specified as equal to the string length - not +1.
In the code snippet for section 5.1.7 Interactive Provider Example: Working with the OmmProvider Class and section 5.2.3 Interactive Example: OmmProviderClient
addRmtes( 212, EmaBuffer( "Market Maker", 12 ) )
Likewise in several examples too including e.g. example IProvider\200_Series\280_MP_Perf\
addRmtes( 296, EmaBuffer("BOS", 3) )