Is the JSON string ASCII, Unicode, wide string, etc..? That alone might be the problem.
Can you give an example of what's stored in the userdatablob and what gets logged when you attempt LogMessage() and don't crash? Matt From: [email protected] [mailto:[email protected]] On Behalf Of Jeremie Passerin Sent: Monday, February 03, 2014 5:47 PM To: softimage Subject: [C++] Reading UserDataBlob as JSON String 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; }

