Field length VS String Null terminator
Hi,
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
EmaBuffer("5", 2)
In other cases (the majority), the length passed to the buffer is the string length without the null terminating character.
Thanks
Best Regards,
Paolo
Best Answer
-
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) )
0
Answers
-
Thanks for the answer.0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛