Hello, we are suing RFA 8.1 C++ api's with MBP domain. We receive "key" in Buffer type. The type of the "Buffer::c_buf()" is "unsigned char *" where as std::string requires "char *". Is using DataBuffer::getAsString" is safe in this case?
@mktdata
Sorry about the issue that you are facing.
The key primitive type is a buffer, not a string.
It is better to use getBuffer(), as shown in the example code.
case DataBuffer::BufferEnum: { const Buffer& buf = dataBuffer.getBuffer(); sData = new char[buf.size() + 1]; strncpy( sData, (char*)buf.c_buf(), buf.size() ); sData[ buf.size() ] = '\0'; write( "%s", sData ); delete[] sData; }
I hope that this information is of help.