RFA 8.0 C++ DataBuffer fields handling

There are these field types:

StringUTF8Enum/StringAsciiEnum/StringRMTESEnum. Can I call getAsString() for all of them if I don't care UNICODE issue?

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @ming.cheng

    Thanks for reaching out to us.

    For a general usage, it is better to refer to the code used in the example.

            case DataBuffer::StringAsciiEnum:
            case DataBuffer::StringUTF8Enum:
            case DataBuffer::StringRMTESEnum:
            case DataBuffer::XMLEnum:
            {
                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.

Answers