Hi List,
My coworker Tyler is writing his first Cpp solver and we are having a hard
time reading value from a userdatablob.
The data blob is created and filled by a Python script. The data is a
dictionary stored as a Json string. The value is static.
>From the C++ solver we connect this datablob to an inputport to read it's
value.
As a test we just tried to log the string value of the datablob, but it
either crashes or doesn't log what we were expecting. In the following
example it crashes.
Any idea what we are doing wrong ?
thanks,
Jeremie
CStatus simplexCPP_Update( CRef& in_ctxt ){
OperatorContext ctxt(in_ctxt);
Application app;
Operator op(ctxt.GetSource());
CValue blob = ctxt.GetInputValue(0,2,0);
app.LogMessage(blob.GetAsText());
const unsigned char *x = NULL;
UserDataBlob b = UserDataBlob(blob);
unsigned int size = 0;
b.GetValue(x,size);
CString * cstr = (CString*) x;
app.LogMessage(*cstr);
return CStatus::OK;
}