What happens to my string data?



Mex problem for you....
Trying to convert a perfectly well behaved C struct of string
variables to plhs[0] I added this code to check what was about to be
returned return:

for(int j=0;j<NUM_FIELDS;j++){

mexPrintf("%s:
%s\n",mxGetFieldNameByNumber(plhs[0],j),mxArrayToString(mxGetFieldByNu
mber(plhs[0],0,j)));

}
some of the data (mostly numerical strings) were good, some where
bad. How did that happen?

Note: I populated plhs[0] with something similar to this:

mxSetField(plhs[0],0,"M_Field_Name",mxCreateString(C_Struct->C_Fiel
d_Name));

Or am I going dotty in my old age?

Thanks if you can see what's up

Tim
.



Relevant Pages

  • Re: how to store list of varying types
    ... When there's a variable-length string, ... typedef struct { ... pointer null, and the second one the CString object. ... then have to finish constructing the packet by copying the two data objects ...
    (microsoft.public.vc.mfc)
  • Re: MVC in C++
    ... Things are now flowing more along the classic MVC lines. ... > struct Observable ... > string version; ... In that case the Controller would trigger a model update *and it* could ...
    (comp.object)
  • Re: can someone please help me with making this class
    ... struct and another I put the insert in. ... string phoneNo; ... node *temp, *prev; ...
    (microsoft.public.vc.language)
  • A note on personal corruption as a result of using C
    ... Many people in this ng are personally corrupt and use this ng to take ... "A string cannot contain Nuls" Yes it can. ... "A struct is a class" No, ... It appears that no C maven has read a history of mathematics. ...
    (comp.programming)
  • Re: Client - server application C++ - C#
    ... The key word is serialization. ... to XML or to string buffer. ... struct user ...
    (microsoft.public.win32.programmer.networks)