The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, gkmethy, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik, Tibor Lorántfy, rmasaki

By Daiszy
#302557
Hello everyone,,
I try to use API Dev 11 to develop my Add-on. And I found that GSRoot Document (come with API Dev 11) is out-of-date. I can not find any method (fuction) to work with GS::uchar_t ( such as GS::ucscpy ...). So I must try some code in an example.
I can use some example-code to develop Add-on that can change 'realValue' parameter of my Object. But when I try to change 'uStrValue' parameter using code like ...
CHCopyC ("Dir", chgParam.name);
GS::UniString tmpUStr ("Left");]Mobdro Lucky Patcher Kodi
GS::ucscpy (chgParam.uStrValue, tmpUStr.ToUStr());
My ArchiCAD will be crash !
How can I solve this problem and how can I find document about GS::uchar_t ?
Thank you
Daiszy.
Last edited by Daiszy on Thu Oct 10, 2019 8:21 pm, edited 4 times in total.
#302559
Hi Daiszy,

Someone had the same issue like you have in this topic: viewtopic.php?f=23&t=68038

I answered it there:
Tibor Lorántfy wrote:
Tue Oct 08, 2019 9:33 am
Hi,

This should work:
Code: Select all
GS::uchar_t bufferUStr[API_UAddParStrLen];
GS::ucsncpy (bufferUStr, GS::UniString (line.c_str()).ToUStr().Get(), API_UAddParStrLen - 1);
chgParam.uStrValue = bufferUStr;
Just make sure, that bufferUStr will live till you use the chgParam :wink:

A little explanation:
uStrValue is a simple pointer, it just points to somewhere. That's why you cannot write characters into it and you got crash report immediately. You have to set the pointer to an existing array of characters.