Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Type conversion GS::Unistring to GS::uchar_t[]

Anonymous
Not applicable
Hey everyone,

i need to set a GDL param value from my addon and i struggle to define my new value with the correct type.

UInt32 totalParams = BMGetHandleSize((GSConstHandle)memo.params) / sizeof(API_AddParType);
for (int i=0; i<totalParams ;i++){
   GS::UniString pname = ((*memo.params).name);
   if (pname=="search name"){
      GS::UniString old_value = (*memo.params).value.uStr;
      (*memo.params).value.uStr = "???????";   // how to set this
   }
}
As i understand (*memo.params).value.uStr gives me an array of GS::uchar_t values. How is the correct constructor for something like this
GS::uchar_t my_chars[5] = ???; 
or can i convert a GS::Unistring to an uchar_t array? uchart_t seemes to be just a Utf16Char but i lack the understanding of those types. Any help would be aprreciated.

Thanks in advance!

Edit:
(*memo.params).value.uStr = "???????"; will not work but i found the example in the docs for APIAny_​OpenParametersID so i will use that. The question of the type conversion still reamains.
1 ACCEPTED SOLUTION

Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
One example from the Element_Test example Add-On:
const GS::UniString tmpUStr ("TestName");
GS::ucscpy ((*memo.params)[ii].value.uStr, tmpUStr.ToUStr ());

View solution in original post

2 REPLIES 2

Solution
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
One example from the Element_Test example Add-On:
const GS::UniString tmpUStr ("TestName");
GS::ucscpy ((*memo.params)[ii].value.uStr, tmpUStr.ToUStr ());

Anonymous
Not applicable
As allways, thank you very much Tibor! It's sometimes hard to find the things you are looking for in the examples so thank you for pointing that out as well.

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!